How did King David get forgiveness and why is it different after Christ's death?


First, let's make it clear that David lived under a different covenant with God than we do today. See "Why We Don't Follow the Old Testament" for details. Still there are similarities, which should be expected since both the Old and New Covenants came from the same God.

David was a member of the covenant by his circumcision eight days after he was born. "This is My covenant which you shall keep, between Me and you and your descendants after you: Every male child among you shall be circumcised; and you shall be circumcised in the flesh of your foreskins, and it shall be a sign of the covenant between Me and you" (Genesis 17:10-11). As a member of that covenant, he then had access to the terms laid out for the forgiveness of sins. Part of which required the offering of sacrifices (Leviticus 4:20; 5:13). Another requirement of God was confession of sin (Psalms 32:5) which we see David doing. "So David said to Nathan, "I have sinned against the LORD." And Nathan said to David, "The LORD also has put away your sin; you shall not die"" (II Samuel 12:13).

Under the new covenant of Christ, one becomes a member through baptism. "In Him you were also circumcised with the circumcision made without hands, by putting off the body of the sins of the flesh, by the circumcision of Christ, buried with Him in baptism, in which you also were raised with Him through faith in the working of God, who raised Him from the dead. And you, being dead in your trespasses and the uncircumcision of your flesh, He has made alive together with Him, having forgiven you all trespasses" (Colossians 2:11-13). As members of the covenant, Christians then have access to the terms laid out for the forgiveness of sins committed while living under the covenant. "If we confess our sins, He is faithful and just to forgive us our sins and to cleanse us from all unrighteousness" (I John 1:9).

While entrance into the covenant was different, forgiveness based in part on confession of wrong remains similar between the old and new covenants.