(3) Reveal the sinfulness of man (cf.Galatians 3:19). Although the Law was good and holy (Romans 7:12), it did not provide salvation for the nation of Israel. “No one will be declared righteous in God’s sight by the works of the law; rather, through the law we become conscious of our sin” (Romans 3:20; cf.Acts 13:38–39).
(4) Provide forgiveness through the sacrifice/offerings (Leviticus 1—7) for the people who had faith in the Lord in the nation of Israel.
(5) Provide a way of worship for the community of faith through the yearly feasts (Leviticus 23).
(6) Provide God’s direction for the physical and spiritual health of the nation (Exodus 21—23;Deuteronomy 6:4–19;Psalm 119:97–104).
(7) Cause people, after Christ came, to see that they couldn’t keep the Law but needed to accept Christ as personal Savior, for He had fulfilled the Law in His life and paid the penalty for our breaking it in His death, burial, and bodily resurrection (Galatians 3:24;Romans 10:4). The believer in Christ has the very righteousness of the Law fulfilled in him as he obeys the Holy Spirit who lives within him (Romans 8:4).
The purpose of the Mosaic Law raises these questions: “Are you trusting in yourself to keep all the Ten Commandments all the time (which you can’t do)?” OR “Have you made the choice to accept Jesus as your Savior, realizing that He has fulfilled all the commandments all the time for you, even paying your penalty for breaking them?” The choice is yours.
Source ‘got questions.org‘