It is a traditional doctrine of Christian spirituality that a constituent part of repentance, of turning away from sin and back to God, includes some form of penance, without which the Christian is unlikely to remain on the narrow path and be saved (Jer. 18:11, 25:5; Ez. 18:30,33:11-15; Joel 2:12; Mt. 3:2; Mt. 4:17; Acts 2:38). Christ Himself said that His disciples would fast once He had departed (Lk. 5:35). The general law of penance, therefore, is part of the law of God for man.
The Church has specified certain forms of penance, both to ensure that
the Catholic will do something, as required by divine law, while making
it easy for Catholics to fulfill the obligation.