I'm sure if you search the forum you could find plenty of information about this.
But when you take the MCAT depends on how many gap years, if any, you plan on taking. It takes 3-5 months to study for the exam and one month for your score to come back. Med school applications open in June and I think you should try to have your MCAT score back by April or May at the latest in case you need to retake it. And, for some reason, the MCAT is not offered in the Winter.
So, taking all of that into consideration, if you want to matriculate straight from undergrad into med school, you would take the MCAT someone Junior year (in January, for example) so that you get your score back in time to apply during the summer between junior and senior year for admittance in the fall right after graduation. If you want to take one gap year, take the MCAT senior year. If you want two gap years, take it after graduation.
I studied for the MCAT during the summer/fall following graduation and took it the following January (this past January). I got my score back in February and am currently applying. If you aren't in a rush to go to med school, I think it's a good idea to take the test after graduation. That way, you can maximize your focus and you've got all the pre-reqs under your belt. Furthermore, gap years are an excellent opportunity to strengthen your application with extracurriculars. But that's just my opinion.
Although it's great that you're thinking ahead, I also think it's a little early for you to be worrying about the MCAT. You'll have plenty of time to think about this as you progress into undergrad. The best thing you can do right now to prepare for the MCAT is to focus on TRULY learning, understanding, and retaining the information in your classes. Study hard, harder than you did in high school. Don't take shortcuts. Don't fool yourself. Not only will it help you keep your GPA up, but it will make it much easier to prepare for the MCAT when the time comes. The MCAT is not just a test of knowledge, but one of discipline, critical thinking, and mental endurance, which are all skills you should to be practicing throughout undergrad, and which you will need to succeed in medical school. I wish somebody had told me that when I was a freshman.
Good luck with it all. It's a long but rewarding road ahead.