In my native Norway, rehabilitation has been the focus to such an extent that foreign media come to do stories on the 'holiday camps' prison time is served in.
It somehow works, though. Recidivism is very low. Here's a few examples on how inmates do their time
-Education is encouraged - whether it is to a learn a trade or getting a degree (presumably lectures are mostly followed via teleconference).
-Counselling is available to help you deal with whatever issues landed you in prison in the first place.
-As you near the end of your sentence, restrictions are gradually lifted to ease the transition back into society - lower-security units, daytime leave to report to work, halfway houses where inmates can live a normal-ish life in the daytime but need to observe a curfew in evenings/nights.
-After you get out, you have regular one on ones with the social services, helping you find a place to stay, work, family counselling if required etc.
-Companies are offered part of your pay refunded by the state for a limited time if they hire you.
All in all, I guess it can be argued that our pendulum has swung too far towards rehabilitation - but if the point of prison is to reduce the long-term risk and cost of crime, we're doing reasonably well.