My USNA roommate went the USUHS route, albeit 15 yrs ago, and is currently a Navy doctor. Here's how it worked at the time (recognizing things might have changed in the intervening years).
You basically had to major in Chemistry or Oceanography at USNA. Why? Because you had to get organic (or was it inorganic?) chemistry into your schedule. It was a 3-6-5 course (3 hrs classroom, 6 hrs lab, for 5 credits). When you're already taking 18-20 hrs per semester, it's really hard to fit in another 9 hrs unless it's a required course. You might be able to do it w/another major if you validated a LOT.
First class year, you applied to the med schools of your choice. You also applied for the Navy med school program. Meanwhile, on service selection night, everyone else selected. You sat and waited. If you didn't get into med school and/or didn't get selected for the program (two distinct requirements), you got whatever service selection no one else wanted. Not sure if that's still true.
If you were selected for the program and med school, you could opt for USUHS (provided you applied and were accepted). If you opted for a civilian school, the Navy decided which one they'd send you to. Not sure how that decision was made, but I'd guess it related to cost.
If you went to USUHS, you had to pay back: 5 yrs from USNA and another 7 yrs from med school. Time in internship/residency didn't count toward payback. However, if you put in 20 yrs, those years would then be added for retirement pay purposes. Not sure how long in addition to the 5 yrs you had to serve if you went to a civilian med school -- 6 yrs comes to mind but that could be wrong.