Rehabilitation
Some punishment includes work to reform the wrongdoer so that they will not commit the offense again. This is different from deterrence, in that the goal here is to change the offender's attitude to what they have done, and make them come to accept that their behaviour was wrong.
Incapacitation
In the prison system, punishment has the effect of incapacitating the prisoner, and physically preventing him from committing crimes against those outside. The most dangerous criminals may be sentenced to life imprisonment for this reason.
The death sentence also may be invoked for this reason.
Retribution
Retribution is the practice of "getting even" with a wrongdoer - the suffering of the wrongdoer is seen as good in itself, even if it has no other benefits.