Unlike the civilian world, during/After internship you apply for GME2 position. Thus the military exerts a strong selection pressure on what you can do. The military also has the option of sending you out to the fleet as a GMO.
It is different for every service. I can only speak for Air Force. Over the past 2-3 years, the number of applicants for certain specialities (Such as Anesthesia, Radiology, Optho, Ortho, E Med) far outweighed the funded positions. This year a new initiative says that if you do not get selected for residency training while applying as 4th year med student, you will have to do a 2 year Flight Surgeon/GMO tour. Then you are given the option of either riding out your commitment or applying for a residency. Most of the HPSP people in the current SAM course just want to ride out their commitment, however you definetly have an advantage in applying for GME after doing your 2 years as a FS/GMO, and the board will push hard to get you a residency position. Keep in mind if you really want to do Radiology, they can't force you to go into Family Medicine, they will just tell you to be a FS/GMO. Hope this helps.
In short, you cannot be compelled into a specialty you don't want to practice it (except for flight surgery). However, there is a good chance that you won't get the specialty you want, particularly in the Air Force.