They present the repayment as four years of school for four years of service, however, that doesnt include your residency, which you may very well do with the military (as you MUST rank at least one military residency when applying for residencies and in this process, your military match trumps the civilian world). Also, while in school, you do officer training, preferably over your first summer break (assuming you have one). Then, if you have any summer breaks after that, youre supposed to rotate at military facilities for forty days each summer because youre at this point (assuming youre doing HPSP and not the Navys other program that gives about double the monthly stipend plus benefits for dependents, but no tuition, fees, or books). So, assuming you match with the military, your four years turn into four years AFTER residency (so more like 8+ years). Also, there is a risk in doing GMOs or being forced into doing something you dont want to do. Talk to a recruiter and they will tell you that you wont be forced into a specialty, not true. For instance, if you do some good digging around, a few years ago the Air Force was really hankering for some more aerospace docs, so one year they limited the number of radiology slots available and didnt give many people deferments. These people that didnt match radiology and only tried to match radiology were then shuffled into aerospace for a minimum of two years (one year training, one year serving, then given the option to apply for a new residencyultimately dragging out your commitment). In theory, your overseas deployment time is dependent on the branch. Air Force deployments are the shortest (around six months I think), then Navy, then Army (Marines get their docs from the Navy). Also, after each deployment, theres a time frame where you, in theory, cant be deployed again (length again varies with the branch). You may very well be sent to Iraq or Afghanistan. You may also be sent to Germany, Japan, Haiti, etc. Essentially, anywhere the military wants you, they can put you. They do try to keep their docs safe, but, war happens and physicians have died in the ongoing conflict.
As previously suggested, dont do it just for the money because it isnt worth it (even as a primary care doc, once you get out of residency you could budget so that you maintain a low/middle middle class way of life and get your loans paid off in a reasonable amount of time). Also, you HAVE to take into account your family when making this decision, because theyll have to live the military life with you. It really is only a good option if theres no possible way whatsoever to make ends meet between student loans and spousal employment or if you really want to serve in the military while being a doctor at the same time.