This happened in America until the 1980's
Judges would allow a person to join military to avoid jail term.
Military recruiting standards tighened around 1980 I would say.
It would be interesting to see how many of these troops ended up reformed.
By 1983 they were testing recruits for THC so dramatically decreased there selection pool for intel, nukes and spec ops. Others specialities could get waivers.