1 Kings 2:39
And it came to pass at the end of three years, that two of the servants of Shimei ran away unto Achish son of Maachah king of Gath. And they told Shimei, saying, Behold, thy servants be in Gath. And it came to pass at the end of three years, that two of the servants of Shimei ran away unto Achish son of Maachah king of Gath. And they told Shimei, saying, Behold, thy servants be in Gath.
The verse belongs to the history of the undivided kingdom under Solomon, the period covered by 2 Chronicles 1-9. It falls within the account in 1 Kings 2 of Solomon coming peaceably to the throne after David's death and carrying out his father's instructions to secure the throne by his early acts as king. In that record Adonijah after fleeing to the horns of the altar was pardoned for the time but later put to death for a further offence and insult to the king, Joab was also put to death, and Abiathar was retired from the priesthood. Solomon was about twenty years old when he took the throne, reigned jointly with David about six months, and David reigned forty years.
It belongs also to the later history of David recorded in 2 Samuel 11-24 and 1 Kings 1-2, which openly records David's great wickedness in the case of Uriah without covering it up or excusing it. That history records the terrible denunciation of the prophet Nathan and shows how completely that denunciation was accomplished in the judgments that came upon David. It is cited as part of the account of Adonijah's attempted seizure of the throne and the resulting troubles in David's final days, showing that the sword and calamity continued in David's household after his sin involving Uriah.
After three years confined in Jerusalem under Solomon's restriction, oath, and command not to leave, two of Shimei's servants fled to Gath. When Shimei was told his servants were in Gath he left Jerusalem to retrieve them, breaking his oath and the king's command not to leave. Shimei is the man who cursed and reviled David during David's adversity and trouble, and the verse belongs to the account of his downfall and just reward for his wickedness. It belongs to the end of his story after Solomon was crowned king, when his own position came to an end while David was not the one who fell.
He had been allowed to live under conditions of life, and because he failed to abide by those conditions he was put to death for that failure. That death came a little later than Solomon's crowning and at the same time Adonijah and Joab were slain. Solomon's warning to Shimei in 1 Kings 2:37-42 that going out would mean surely dying made the penalty of death certain on the day he disobeyed, while its execution came at a later time. This illustrates that a warning of death can mean the sentence is made certain on the day of disobedience even if death does not occur that day. The same surely die in the law given to Adam means the irrevocable sentence of death passed on him in the day he sinned, with the curse falling on him that very day and his dying condition beginning then, though his actual return to dust was not executed for almost 1000 years.