2 Samuel 15:37

So Hushai David’s friend came into the city, and Absalom came into Jerusalem.

The verse records a moment in David's flight from Jerusalem during Absalom's revolt, when Hushai, David's friend, came into the city at the same time Absalom came into Jerusalem. It belongs to the events surrounding that flight, which form the circumstances associated with Psalm 3. It belongs to the history of David's reign with its many difficulties, including Absalom's rebellion and David's trouble with sons he could not control.

More broadly, it belongs to the troubles in David's family told in chapters 13 to 20, growing out of his multiplying wives to himself, which produced a large family of children by different wives in which idleness, luxury, and jealousy developed unenviable characters. It stands in the story revolving around Absalom the beautiful, whose ambitions were roused by fulsome flattery poured out upon a shrewd and handsome prince. That story involves the base conduct of Absalom, the treachery of Ahithophel, the cursing of Shimei, and the fear and flight of the king in his pathetic journey touching the hearts of his old friends, followed by the defeat of Absalom and the sorrow of his father over the wicked son's fate.

The rebellion, together with unnatural crimes within David's family, is part of the retribution David suffered for his wrongs, especially his wrongdoing and harm against Uriah, showing that sin brings consequences corresponding to the wrong committed and illustrating receiving back in kind. The great lesson is that no one can walk contrary to God's laws and not suffer, for in every transgression of divine law lies the inherent curse even when God does not openly reprove and seems to wink at blindness. Amid these events, David's kindness to the house of Saul remains in evidence.