My father was given this choice and he chose the military. He broke a lot of rules and was booted out. I cannot say for sure that this would happen for a lot of people, but it seems like it would be a waste of time to take the chance.
The military is best when they focus their time and resources on people who want to be there because they want to be there. I think a a judge could recommend the military to the person, but not until civilian punishment is complete.
Perhaps reduce a sentence for a person who has done some of the punishment, and has proven rehabilitation, if they agree to do military service?