The Catholic Church teaches that moral law comes from God as “fatherly instructions” to help us determine what is right and what is wrong.
It prescribes for man the ways, the rules of conduct that lead to the promised beatitude; it proscribes the ways of evil which turn him away from God and his love. It is at once firm in its precepts and, in its promises, worthy of love.Catechism of the Catholic Church 1950
Moral law is the means that God keeps us and directs us toward heaven and away from evil. Moral law should be the basis for civil laws in order to draw all people closer to God.
The natural moral law is the knowledge of right from wrong that all people possess as part of human nature, regardless of culture or religion. For example, there is a universal consensus that murder is wrong. That is a natural law.
The natural law is written and engraved in the soul of each and every man, because it is human reason ordaining him to do good and forbidding him to sin . . .Catechism of the Catholic Church 1954
The natural law should be the basis for all civil laws in order to bind people together and create a just society.
It also provides the indispensable moral foundation for building the human community.Catechism of the Catholic Church 1959
In Old Testament law (old law) God prepared us for the coming of Jesus. The Ten Commandments revealed basic truths which are part of natural law in a way that people could understand and follow. They taught that we must love God and neighbor.
The Old Law is the first stage of revealed Law. Its moral prescriptions are summed up in the Ten Commandments. The precepts of the Decalogue lay the foundations for the vocation of man fashioned in the image of God; they prohibit what is contrary to the love of God and neighbor and prescribe what is essential to it.Catechism of the Catholic Church 1962
In the New Testament (new law) Jesus Christ perfects the law.
Do not think that I have come to abolish the law or the prophets. I have come not to abolish but to fulfill.Matthew 5:17
He shows us that we must really allow ourselves to be transformed into people who act on love.
The Law of the Gospel fulfills the commandments of the Law. The Lord’s Sermon on the Mount, far from abolishing or devaluing the moral prescriptions of the Old Law, releases their hidden potential and has new demands arise from them: it reveals their entire divine and human truth.Catechism of the Catholic Church 1968
We do not just follow the law because we fear God. We follow the commandments of Jesus to act in love because we love him and desire to be close to him. Furthermore, through the sacraments, Jesus gives us the grace to live this new law. This gives us freedom for we are not slaves. Instead we are friends of Jesus Christ.
The New Law is called a law of love because it makes us act out of the love infused by the Holy Spirit, rather than from fear; a law of grace, because it confers the strength of grace to act, by means of faith and the sacraments; a law of freedom, because it sets us free from the ritual and juridical observances of the Old Law, inclines us to act spontaneously by the prompting of charity and, finally, lets us pass from the condition of a servant who “does not know what his master is doing” to that of a friend of Christ – “For all that I have heard from my Father I have made known to you” – or even to the status of son and heir.Catechism of the Catholic Church 1972
For more background read the entire section on moral law in the Catechism of the Catholic Church and Matthew 5:17-20. For a more youth-friendly resource, check out sections 333-336 in Youcat – the Youth Catechism of the Catholic Church.