I don't see how people can be in prison out of misfortune. People on remand aside, those who are there, are there because they have been convicted of a criminal offence, the severity or repeated nature of which warranted a custodial sentence.
The cold, hard truth is that prison is there to serve as a punishment, yes, before someone jumps down my throat, prison does serve to rehabilitate and re-educate as well, but its primary purpose is to punish.
Inmates committed their crimes, knowing that they would be punished by the legal system if caught, so I don't have a great deal of sympathy with them, when they whinge about conditions and the lack of flushing toilets. It's not supposed to be nice, that's why naughty people get sent there and when prisoners whinge about their lot, they would do will to consider who's to blame for it.