> How has the military (US, or other) historically managed to recruit and retain their medical corps, or the Army Corps of Engineers?
The US military will pay for someone's medical school education, and also offers significant signing bonuses for doctors, who then enter the military as officers. Which I imagine is enough to keep a steady pipeline in regular times.
These days so much of US military work is done by contractors, that I imagine they'd just pay contractors whatever was necessary to attract what they needed for specialized non-combat roles. (Heck, contractors end up being in effectively combat roles these days too, even if formally not. Wikipedia says as of 2012, 1,569 US contractors had been killed in Iraq, compare to ~4500 soldiers).
Back when there was a draft in the US, they drafted doctors along with everyone else, and had them be doctors in the military. (Some of my family members were such in WWII). I think they just had draft numbers that came up like everyone else's though, I don't think there was a specific doctor draft.