God gave His laws and commandments to His people to prove to them that they needed a Savior.
Galatians 3:24 says that the law served as a schoolmaster to bring God's people to Jesus. His people couldn't be perfected through the Law.
They needed a Redeemer!