Yes, some online masters programs accept applicants with a bachelor's degree in a different field. Fundamental undergraduate programs usually cover similar basic skills, and other academic skills and concepts can be carried over to your new field of study.
However, if you switch major, you may need to take additional university courses to qualify for admission to the degree in your new major. Alternatively, there are online degrees that include bridging programs. The bridging programs were specially developed to enable students to quickly get started with the core subjects upon enrollment.