Old Testament saints were not saved by keeping the Law, but being broken over their inability to keep it, they came to God as penitents, hungering and thirsting for righteousness and mourning over their sin. God then mercifully and graciously forgive their sins based on what Christ would accomplish in the future by His substitutionary death. Having been saved by grace through faith, the Old Testament saints found the moral law a source of blessing and joy. They could then exult with the psalmist, 'O how I love Your law! It is my meditation all the day (Psm. 119:97). The Law then became to them 'more desirable than gold, yes, than much fine gold; sweeter also than honey and the drippings of the honeycomb' (Psm. 19:10). It was not their attitude toward the law that saved them; rather, salvation changed their attitude toward the Law, and they repented and in faith sought God's gracious forgiveness.
John MacArthur