“Even as David also describeth the blessedness of the man unto whom God imputeth righteousness without works, saying, Blessed are they whose iniquities are forgiven, and whose sins are covered. Blessed is the man to whom the Lord will not impute sin” (Rom. 4:6-8).
Obviously David knew no more about the present “dispensation of the grace of God” than did Abraham, and he certainly did not live under the dispensation of grace. He lived under the dispensation of the Law, when sacrifices were required for acceptance with God. Had David said that the offering of sacrifices was unnecessary, he would have been stoned according to the Law.
But David, unlike many today, understood the purpose of the Mosaic Law: to bring man in guilty before God. In Psalm 130 he said: “If Thou, Lord, shouldest mark iniquities, O Lord, who shall stand? But there is forgiveness with Thee.” He did not know how God could righteously acquit a guilty sinner, but he believed it to be a fact and rejoiced in Psa. 32: “Blessed is he whose transgression is forgiven, whose sin is covered… unto whom the Lord imputeth not iniquity…”
Thank God, we now know the reason! God has revealed through Paul, the chief of sinners saved by grace, how He can be “just, and the Justifier of him that believeth in Jesus” (Rom. 3:26). It is because “God hath made Him [Christ] to be sin for us, [Him] who knew no sin, that we might be made the righteousness of God in Him” (II Cor. 5:21).
David’s blessedness may be ours too, if we will but do what David did: trust in Him who graciously forgives sin and (as we now know) justifies believers on the basis of the redemptive work of Christ. source