2 Samuel 12:15
And Nathan departed unto his house. And the LORD struck the child that Uriah’s wife bare unto David, and it was very sick. And Nathan departed unto his house. And the LORD struck the child that Uriah’s wife bare unto David, and it was very sick.
The verse belongs to the account of David's adultery and murder of Uriah, in which David made Uriah the bearer of his own death warrant by sending in his hand a command to Joab to place Uriah in the forefront of the hottest battle and withdraw from him so he would be struck and die, which Joab obeyed so that Uriah fell by the sword of the children of Ammon. After Uriah's death Joab sent word by a messenger with a carefully worded report designed not to implicate Joab or the king, instructing him to tell the matters of the war and only if the king's wrath arose to add that Uriah the Hittite was dead also, and David answered that the sword devours one as well as another and told Joab to make the battle stronger against the city and overthrow it.
David's command to set Uriah in the forefront of the hottest battle and abandon him to be smitten and die came from departing from God and yielding to the wicked one while still holding the position and authority God had given him. Joab transgressed God's law by obeying the king rather than God because his allegiance was given to the king. Power given by God is to be exercised only in harmony with divine law, and when a ruler commands what is contrary to God's law it becomes sin to obey.
The Lord struck the child born to David and Uriah's wife with severe illness so that it became very sick, as a consequence and retribution for David's transgression and violation of God's will after forsaking God's teaching. David sincerely repented and was forgiven, yet he still lost the child. David's departure from the Word also sullied his formerly fair reputation.