Correction means to make something right that was wrong. A person who notices a wrong and is able and authorized to do so, can correct their own as well as another person's wrongs.
The word is used in punitive situations, such as dealing with a criminal offender or a child that committed a grave offense, to mean punishment, but in a sense that emphasizes the corrective nature as well as the indisputable necessity of such punishment. It can refer to any type of punishment.
The term makes clear that without such correction, the wrong would persist, whereas if the punishment is given, no new wrong is introduced, but instead, the punishment will wipe the bad away that came with the wrong. Metaphorically speaking, the offense is like a poison and the punishment is its antidote that restores health.
The term became very popular in the 20th century as an euphemism for punishment, a term which is more and more avoided due to its negative connotations. The term "correction" is encountered in school and boarding school environments, but even more so in judicial punishment. For example, a prison guard may be called "corrections officer".