It depends on what you want to do. Applications open up around early June every year. The application cycle is a year long so if you were to apply say, for example, this year 2017 then you are trying to get in for the class of Fall 2018. If you want to go to medical school right out of undergrad you would be applying the June of the summer right before your Senior year. Interviews and all that jazz will be during your senior year.
Take the MCAT whenever you're ready, preferably after you finish all of your pre-reqs. The study time is different for each person and really depends how long you can actually dedicate to studying (the number of months don't matter, but the quality number of hours per week you can get in as a full time student with all of your other activities). It also just depends how strong you are in the subjects (Biochem, Bio, Orgo, Gen Chem, Physics, Psych/Sociology, and CARS). I personally needed 6 months because I was working full-time and doing volunteering at the same time, but I was already out of school.
If you can start prepping the summer before your Junior year because most of your pre-reqs should be done by then (except for maybe biochem and genetics, so maybe plan to take them in the fall of Junior year?) and take the test around January right after winter break in your Junior year, that would be perfect imo.
Edit: Aww
@E.Hemingway beat me to it, but yeah I agree with him on everything