2 Samuel 12:17

And the elders of his house arose, and went to him, to raise him up from the earth: but he would not, neither did he eat bread with them.

The verse belongs to the aftermath of David's murder of Uriah, in which David made Uriah the bearer of his own death-warrant by sending through his hand a letter commanding Joab to set Uriah in the forefront of the hottest battle and then retire from him so that he would be smitten and die, which Joab obeyed so that Uriah fell by the sword of the children of Ammon. In ordering Uriah's death, David used his God-given kingly authority contrary to God's law, and Joab transgressed God's law by obeying the king rather than God.

The verse shows David fasting in deep humiliation and heart-broken grief, having put off his royal robes and laid aside his crown and lying prostrate on the earth night after night pleading for the life of his sick, stricken child. The elders of his house arose and went to him to raise him up from the earth and to eat bread with them, but he refused to be raised and refused to eat with them. He persevered in supplication while the child lived because judgments pronounced upon persons and cities had often been turned aside by humiliation and repentance, and because God is swift to pardon and sends messengers of peace.

The child suffered as an innocent one for David's own guilt, and though David was forgiven for his sin he suffered the loss of the child as punishment for his transgression, with his forsaking of God's doctrines bringing retribution and sullying his reputation. When he learned the child was dead, he quietly submitted to the decree of God, rose and no longer continued mourning, accepting the death as the first stroke of the just retribution he himself had pronounced, and trusting in God's mercy he was not without comfort.