I am doing undergraduate in engineering but I want a transition to humanities for masters (history, anthropology).
How do I do this?
Should I take prerequisite courses at a community college or through online/distance education?
While I think the other way around (transitioning from the humanities to the sciences) might be harder, if you can demonstrate that you are serious and prepared to undertake graduate training in the humanities, it is definitely doable.
In my sociology department (PhD track, we didn't have a separate MA program and most entered straight after undergraduate school), many of my colleagues did not have any sociology training. While most of them came from related fields of economics, political science, and psychology, there were people with math and physics backgrounds and these were sometimes the people who were doing the most innovative and interdisciplinary work. The selection committee was fine with accepting them as long as their proposed research area fit with the department faculty's research and they showed promise as a sociologist.
While a degree in the field isn't necessary, make sure you address how you have been working to fill the gap you have on your CV. A personal statement will be a good place to address this. In addition, you can take additional courses, read as many works in your proposed field, and try to have a well developed study plan to give confidence to the committee that you are as competitive as the other candidates. It might be a good idea to also build contacts with professors in schools that you are applying for and go talk to them to see if they will be interested in working with you. If you plan to specialise in a society other than where you are based in (especially in case of anthropology), make sure you demonstrate regional expertise, language skills, knowledge of the society, or maybe work and/or living experience. Also, since those departments (in case of a PhD program) will likely ask for a writing sample, start working on one well in advance so the committee can see that you can indeed to the work in the proposed field.
This really depends on the country. In the US, most undergraduate programs offer enough flexibility to take a lot of electives. You can also extend you studies by a semester to pick up additional prerequisite classes. In the UK, there is generally not enough flexibility to take electives and you cannot easily extend your studies. Further, you likely would not have the prerequisite A-level classes to get into a humanities program. It a probably best to go talk to someone in the relevant department at your university for advice.
Briefly speaking, your odds of getting admitted to a program of distinction (necessary for any academic job prospects) is low unless:
Remember, in humanities, admittance to a truly outstanding program is required for even limited career prospects. Do not settle for a lower ranked program.
I would suggest choosing either anthropology or history as they are fairly distinct areas of study when you get past the surface of things. If you haven't already picked a minor in either history or anthropology. This way you can see if it's a passing fancy or something you are serious in.
If it turns out you are then you will be part way there for the second degree. You may depending, on how far in you are, be able to dual degree in engineering and history/anthropology. If you can't dual degree but you took the minor you will then probably have enough to go on to appear like a good match for most schools you may apply to for graduate studies. You will also have the side of not having to go through as many lower undergrad classes to catch up with the mainstream majors.