In his 6th March 2018 prison reform speech , the Justice Secretary The Rt Hon David Gauke MP stated the following:
Purpose of prison
Depriving someone of their liberty for a period of time is one of the most significant powers available to the State and must be imposed with respect for the rule of law and with purpose.
Prison is the sharp end of our justice system. By imposing this serious sanction, we must be clear about what prison is for.
I believe its purpose is threefold:
First, protection of the public – prison protects the public from the most dangerous and violent individuals
Second, punishment – prison deprives offenders of their liberty and certain freedoms enjoyed by the rest of society and acts as a deterrent. It is not the only sanction available, but it is an important one.
And third, rehabilitation – prison provides offenders with the opportunity to reflect on, and take responsibility for, their crimes and prepare them for a law-abiding life when they are released
https://www.gov.uk/government/speeches/prisons-reform-speech
Although long, I do think this is worth a read