Penance was instituted by Christ after the resurrection when he breathed on the disciples and said, “Receive the Holy Spirit. If you forgive the sins of any, they are forgiven; if you retain the sins of any, they are retained.” ~John 20:23
In the early Church, confession and penance were very public affairs. If a person committed a grave sin, they would ask the bishop for penance and would publicly live as a penitent, meaning they did not receive communion and spent much time in prayer, fasting, and almsgiving. Sometimes this penance would last for years until the person would be forgiven and allowed to return to normal Christian life. At this time, penance could only be done once in a lifetime.
A new way for celebrating this Sacrament came to us from the Celtic or Anglo-Saxon peoples. The once-a-lifetime limit was lifted. The sin itself was kept secret and even though the penance could last for years, the penitent would be given absolution in advance. At this point, we have the beginnings of our current celebration of the Sacrament: confession, absolution, and then doing the penance. Formally, the Sacrament was refined in 1215 & in the 1400-1500s, the councils of Florence and Trent more precisely defined the nature and Sacrament of Reconciliation.