1) Prisons in the United States are ridiculously overcrowded (often at 200% of capacity in places like California) and jail sentences increase, not decrease, criminal behavior after release.
2) The military has trouble meeting recruitment goals.
Solution: Eliminate mandatory minimum sentencing and introduce military alternatives to jail sentences.
Mandatory minimum sentences were initially created (and still most widely used, as far as I know) in drug cases. According to speakout.com, the law that initially introduced mandatory minimum sentencing increased time served for the average drug related offense from 22 months to 66 months. Mathematically, this must lead to more crowded prisons. Meanwhile, in the decade after introduction of the law, the number of drug violations increased 48.2 percent. While this isn't conclusive evidence that mandatory minimum sentencing doesn't work as a deterrent, it is suggestive. This increases prison crowding without reducing crime.
Meanwhile (also speakout.com), in 2000, the federal government spent $1,910 per inmate per month to keep them in prison. This cost has only gone up since then.
To make things worse, prison doesn't seem to rehabilitate prisoners into society. According to BBC Radio 4 (via the wikipedia article on recidivism), the US recidivism rate in 2005 was ~60%. If the goal is to take criminals and make them productive members of society instead of drains on society, prison may not always be the answer.
I propose an alternate solution: for non-violent criminals, the choice to enroll in the military may be a good option. If somebody is caught in possession of drugs, committing white collar crimes, or perhaps even distributing drugs, and he or she is in the proper physical condition, a 2-year military sentence may instill a sense of discipline and purpose while providing usable skills. The military has trouble meeting recruitment goals as it is, so this may provide a source of troops who can pay their debt to society while rehabilitating themselves. This would not have to be mandatory (that would amount to conscription), but it could be an option that many would take, especially if choosing it led to fewer consequences of record.
Former felons in the military right now actually win more distinguished service medals and get through boot camp at a higher rate than non-former felons. Meanwhile, the rate of disciplinary incidents is only marginally higher, and AWOL rates are at historic lows even as former-felon waivers increase. (This was in the news recently... can anyone send me a link?)
Of course, in the case of certain violent crimes, prison is the only answer, and the military may not be appropriate for criminals who are too young or old, out of shape, etc. But for other crimes (Drug possession, some white collar crimes, etc), there should be alternatives to unproductive prison.