It is pretty clear that today the US military is an all volunteer force and it is not allowed to take people who are joining to avoid going to prison. Was there ever a time when a judge could sentence a criminal to prison or military service? If so, how did it work? Was it for a fixed time and what happens if the criminal was found not fit for duty and separated from the military?
Over the years I've read many accounts where people stated that they were told by a judge that they could spend X months in jail or they could join up. This could never hold up as a law in any state, but is more of an informal use of a judge's discretion. It's probably a lot less common today with today's very professional military. A simple Google search turned up only this one case on the first page of results: https://www.stripes.com/news/judge-said-army-or-jail-but-military-doesn-t-want-him-1.44417
This was much more possible during World War II when America needed "every man." Some years ago, I knew a man (born in 1925) who was arrested for "carjacking" who was sentenced to two years, with sentence to be suspended if he would volunteer for two years in the Army (and they would accept him.) That, in fact, did happen.
The judge probably figured that the rehabilitative impact of the one would be as great as the other, but the Army offered the more productive outlet for both the convict and for society.
My father punched one of his high school teachers. Justifiably, IMO, based on the story as he told it.
This occurred a few years before the end of the Korean "conflict". He was given the choice that day to go with the police or go with his parents (he was under 18) to an Army recruiting office.
It's not as easy to join the military these days so this tactic is no longer viable. A modern analog would be the courts sending people to AA meetings in return for a lighter penalty - they can't force anyone to go so they manipulate them into it.
Jimmy Hendrix was given the choice of prison or military service. Wikipedia his name.
This is intriguing because it's usually a "don't ask, don't tell" military thing. I was in the US Army for 2 years (2003 - 2005) and over time I've learned it definitely happens but probably a low percentage of military recruits. The compelling issue is what the exact percentage is. When I was in Army AIT, my AIT Drill Sergeant actually told us he was forced to join the Army via court order (a drug type of charge). Ah, but see Drill Sergeants are considered elite members of the military and so the Army successfully rehabilitated him. My roommate in Germany informed me he was also forced to either join the Army or go to Jail. He didn't tell me what charges he had but he had a serious criminal record/history. Even in basic training, they had a marching cadence: "Got a letter in the mail: Go to War / Go to Jail". Once in the Military, the secret is that the expendable criminals get the military equivalent of the death penalty as illustrated (but implied) in some war movies. My dad even once told me that this is the way it's always been and the way it always will be. He was retired Army having served 30 years and served in Vietnam (safe areas). Only the worst criminals get sent to the violent areas where low life-expectancy is expected. And from what I saw, this is incredibly true. Soldiers are expected to eventually have the choice to choose the Army as a life-long career, because anyone who served knows that after basic training stages, the military recruit is like a civilian and many work civilian-equivalent jobs.
Just to point out one more example: remember the movie "Platoon"? There was, for example, a brief scene showing US Army soldiers raping indigenous children and remember when Taylor tried to break it up? So ... what happens to those rapists? They get sent to a very specific area with the only intention is to make them suffer or get killed and buried in a pile of corpses as if to imply not even worth an official burial.
Okay, one more example. In the movie "Full Metal Jacket," there was a part when the Drill Instructor said: "Marines are not allowed to die without permission." This is 100% true in other military branches as well.
The answer to the original question is YES.
"In 2007, it published information obtained through the Freedom of Information Act that found the number of convicted criminals enlisting in the US military had nearly doubled in two years, from 824 in 2004 to 1,605 in 2006. In that period, a total of 4,230 convicted felons were enlisted, including those guilty of rape and murder. On top of this, 43,977 soldiers signed up who had been found guilty of a serious misdemeanour, which includes assault. Another 58,561 had drug-related convictions, but all were handed a gun and sent off to the Middle East. "The fact that the military has allowed more than 100,000 people with such troubled pasts to join its ranks over the past three years illustrates the problem we're having meeting our military needs in this time of war," said Aaron Belkin, director of the Palm Center." (https://www.alternet.org/2012/10/dark-secret-us-military-neo-nazis-and-criminals-are-filling-its-ranks/)
Question: Was it ever possible to join the US military instead of going to prison for a crime?
Local Prosecutors and judges can do whatever they like. They can tell someone to join the army or face prison, etc. There are plenty of stories of these kinds of things occurring, especially in Korea and Vietnam. However; that doesn't mean the army willingly accepts folk as an alternative to prison. army recruiters are forbidden to participate in such arrangements and all branches of service will disqualify such candidates if they find out.
The Army's Recruiting Regulation, 601-210, paragraph 4-8b: Any "applicant who, as a condition for any civil conviction or adverse disposition or any other reason through a civil or criminal court, is ordered or subjected to a sentence that implies or imposes enlistment into the Armed Forces of the United States is not eligible for enlistment."
Still one can image that it has happenned and still happens. The army will make a man of him, kind of thing.