Moose said:
Who cares if it works. Prison is about punishment, not rehabilitation.
Prison is about punishment AND rehabilitation.
It serves as a punishment by removing your freedom. In a way this loss of freedom can also work as a rehabilitation of sorts on the offender.
It serves as a rehabilitation as well. Programs and services are run with in the prison to assist people to change their behaviour, to change it so they can contribute to constructively to the community and to adjust to life after prison.
Obviously this isn't the case for every offender. But it can serves as a chance for rehabilitation also.