David received forgiveness after he confessed his sin with Bathsheba (see 2 Samuel 12:13–15). In 2 Samuel 12:10 Nathan called her “the wife of Uriah the Hittite.” Now that all sins are forgiven, she is David’s wife. In Matthew 1:6 in the genealogy of Christ, however, it is written that David was the father of Solomon “by the wife of Uriah.” That is to indicate David’s downfall and the forgiving grace of God.
24 Then David comforted his wife, Bathsheba, and went in to her and lay with her, and she bore a son, and he called his name Solomon. And the LORD loved him