It depends on which branch you are considering. When I looked into this a few years back, the Navy required 4 years of active duty and 4 years of reserves. Then you were done. You didn't have to do a military residency, but if you do, those years as a resident will count toward your commitment.
The Air Force, on the other hand, required 4 yrs active duty, 4 yrs active reserve, and then on inactive reserve for the rest of your life. What that means is, if there is another draft, they could call you up long after you've fulfilled your time and draft you into service again. Now, that seems farfetched....but, perhaps not as farfetched as I would've believed a few years ago.
As I understand it, there aren't a whole lot of military residencies to be had anyway, so most people end up doing their residency at a civilian hospital and then going into the service (with the rank of an officer, btw).
Good luck in deciding! It's not a bad deal if you've any desire at all to serve in the military.
Willow