First off, which service? Secondly, which route (academy, ROTC, OTS, etc)? In the USAF, you don't just enlist and go to flight training. Commissioning programs are competitive and require applications (usually lengthy). Getting a pilot slot is also very competitive and lengthy.
Grades (or prior military experience) are important to get into commissioning programs. College grades also help determine order-of-merit, which influences your chances of getting a pilot slot.
I recommend looking at www.academyadmissions.com and www.afrotc.com as start.