They're in prison because "justice" needs to be done for the crime they committed against fellow human beings. They're in there for _punishment_. Once you start giving them free meals, clothing, warmth, internet, tv - then what kind of punishment is this? Do you seriously want people who have robbed, killed, trafficked, drugged etc to live like that?
Is it good, ideal? No. Is it better than "an eye for an eye"? Probably.
As for rehabilitation, I will not even start to discuss it, prisons and rehabilitation have nothing to do with each other.
Personally I'd like to see end of prisons, at least for many minor offenses.
Prisons might be a deterrent, but locking up people who never caused physical harm to others is insane. Those should be alternate sentences.
For minor offences I agree there shouldn't be a case of imprisonment. I'd send those people to do some community work and maybe learn something good from it.
Oh, wait, that doesn't work. Perhaps treating them like normal human beings instead proves more effective[2].
[1]http://bjs.gov/index.cfm?ty=tp&tid=17 [2]http://www3.unil.ch/wpmu/space/publications/recidivism-studi...