Based on people I know who have been in prison I think that they don't work but that it's a problem of implementation rather than something inherent. I do also think that too many criminals who don't get sent to prison for minor offenses which set a pattern that later escalates to more serious crime by which time it's too late.
I believe that prison should be a place of both punishment and rehabilitation. First punishment then rehabilitation, to try to do both at the same time is insanity. The first time some one is sent to prison a little punishment followed by a lot of rehabilitation, subsequently more punishment and less (proportionately) rehabilitation. The punishment should be such that it provokes a real fear of returning to prison and the rehabilitation should look to find and address the factors that lead the person to crime.
Where possible first time offenders should be housed separately from repeat or long term offenders. This would reduce the opportunities for someone who maybe just 'fall in with a bad crowd' to fall in with a worse one by meeting people with established connections to the criminal infrastructure.
There is over crowding in prisons, fortunately there is a fairly simple solution to this. Build more prisons, but be smart about where they are built. There are many small islands in the North Sea and North Atlantic that used to be occupied crofter subsistence farmers but were abandoned in the 19th and 20th centuries when crofting became uneconomic and people left for the mainland. These would be ideal sites for prisons for the punishment phase of a sentence. Due to the remoteness and hostile climate a prison, in particular one built to a Panopticon design, would need less staff than a traditional design built in a city. The hostile but livable climate (remember, people lived there for centuries quite well) provides both an extra element to the punishment directly and would allow opportunities for the prisoners to be put to work growing some of the food required so reducing costs further (less food to ship in) and improving security (someone tired from working in the fields is unlikely to have the energy to cause trouble). It may also inculcate the idea of working for reward and lay the ground work for the rehabilitation phase that follows. The location may cause problems for visiting, but then this is the punishment phase and isolation from past associations may both enhance the punishment and disrupt links to factors that put the prisoner in the position of committing crimes.
Moving prisoners to remote island prisons for the punishment phase would free up spaces in more traditional prisons in towns and cities for the rehabilitation phase.
Not PC, but true.