Nevertheless, because by this deed you have utterly scorned the LORD, the child who is born to you shall die.”
It seems to have been a great while after David had been guilty of adultery with Bath-sheba before he was brought to repentance for it. For, when Nathan was sent to him, the child was born (Sa2 12:14), so that it was about nine months that David lay under the guilt of that sin, and, for aught that appears, unrepented of.
Commenting on 2 Samuel 12:1-14
And Nathan departed unto his house,.... His own house, which probably was in the city of Jerusalem, having delivered his message, and brought David to a sense of his sin, and declared to him from the Lord the forgiveness of it; yet for the honour of religion, and the stopping of the mouths of blasphemers, the death of the child is threatened and foretold, and...
Howbeit, because by this deed thou hast given great occasion to the enemies of the LORD to blaspheme, the child also [that is] born unto thee shall surely die. (h) In saying, that the Lord has appointed a wicked man to reign over his people.