1 Samuel 22:4-5
22:4 So he had them stay with the king of Moab; they stayed with him the whole time that David was in the stronghold.
22:5 Then Gad the prophet said to David, “Don’t stay in the stronghold. Go to the land of Judah.” So David left and went to the forest of Hereth.
1 Samuel 24:22
24:22 David promised Saul this on oath. Then Saul went to his house, and David and his men went up to the stronghold.