World over, the purpose of sending someone who has committed a crime to prison is to ensure the offender is rehabilitated with the objective of preparing him/her to re-enter society upon completion of his jail term.
In Kenya, this is especially important after the Supreme Court in 2017, while ruling in the Francis Karioko Muruatetu and Another vs Republic, declared mandatory sentences (life and death sentences) unconstitutional.