The Ten Commandments are the law of God given to Moses on Mount Sinai. It was given to mankind to reveal their sinful condition.
Romans 7:7-8 says, “What shall we say then? Is the law sin? God forbid. Nay, I had not known sin, but by the law: for I had not known lust, except the law had said, you shall not covet. But sin, taking occasion by the commandment, wrought in me all manner of concupiscence. For without the law sin was dead.”
Sin is made “alive” or “aroused” by the law. If there was no law then sin isn’t imputed to the sinner. If there is no law then can there be any transgression? The law was given to stop our self-justification that we are basically good, moral people. The law brings people face-to-face with their need for salvation and was given to the unrighteous man.
The word of God says in 1 Timothy 7 the law is good when used correctly. It was established for people who are lawless, rebellious, ungodly, sinful and who consider nothing sacred and defile what is holy. The law isn’t able to produce holiness or give life, nor can it cleanse our consciences or make us righteous.
To paraphrase Martin Luther, the main function of God’s law is to first and foremost show us we are sinners. Our failure to obey these laws should drive us to the foot of the cross seeking forgiveness. The law should convict and bring about godly sorrow which works repentance leading to salvation.
It’s only through the law being established did mankind find out they could not obey them, if you broke one you were guilty of breaking the whole law. The only one who kept the entire law was the man Christ Jesus, who provides salvation and paid the price for the sins of mankind.