In the Old Testament, God gave Israel the law, or the ten commandments. There were also many other laws which were given to the Israelites. The law was given for a purpose, and that is to reveal sin. If there were no law, we would not know that we were offending God.
Ultimately, the law was meant to reveal our need for a Savior, our need for the Lord Jesus Christ. Wherefore the law was our schoolmaster to bring us unto Christ, that we might be justified by faith. - Galatians 3:24 We can not be saved by keeping the law because we can't keep it. We are saved by faith, that is by putting our trust in Christ. For by grace are ye saved through faith; and that not of yourselves: it is the gift of God, Not of works, lest any man should boast. - Ephesians 2:8-9
As Christians, if we are truly born again, we are no longer under the law. But after that faith is come, we are no longer under a schoolmaster. - Galatians 3:25
The Apostle Paul wrote; I am crucified with Christ: nevertheless I live; yet not I, but Christ liveth in me: and the life which I now live in the flesh I live by the faith of the Son of God, who loved me, and gave himself for me. - Galatians 2:20. We as Christians, are to live trusting Christ to live His life in and through us. We can't keep the law, but He can keep it in us.