Prison isnt just about rehab, its also about punishment, and thats good.
None of this requires the use of prisons. Although in the case of offenders likely to commit more violent crimes while justice is sort for previous offenses it, appears, to be our currently best way of management.
Similar to how the aim of schooling is to create citizens who can engage productively in society; the focus of prisons should be on recreating productive citizens.