Source - wikipedia
"Penance" also refers to acts that a believer imposes on him or
herself outside of the sacramental context. Penitential activity is
particularly common during the season of Lent and Holy Week (mainly
the Passion week, inspired by Christ's suffering;
hence in some
cultural traditions still including flagellantism or even voluntary
crucifixion) and, to a lesser extent, Advent, when
penance is often combined with acts of self-discipline, such as
fasting, voluntary celibacy, or other privations.
In the Roman Catholic tradition especially, such acts of
self-injury are sometimes called mortification of the flesh because
of the belief that an unrestrained corporeal body endangers
salvation, unless controlled by the spirit, serving to detach the
penitent of his worldly passions, as to draw him into closer union
with God.
Penance was originally meant to be something good. i.e
apologising to the injured party and compensating him or her for
the hurt caused. In the case where no one was harmed, penance was
meant for the person seeking forgiveness to do good deeds like
charitable work to atone for his sins.
I strongly condemn penance with the intention of hurting oneself.
This is morally wrong as the body is the temple of God, and
additionaly it serves no real purpose other than self-edification.
Instead of taking a negative view and inflicting (self) punishment
isn't it better to do good and help others that they may praise God
too?