When Saul was told that David had gone to Keilah, he said, "God has handed him over to me now because he has trapped himself by entering a town with gates and bars!"
References for 1 Samuel 23:7
So Saul called up all his troops for war, to go down to Keilah and attack David and his soldiers.
When David learned that Saul was planning to harm him, he told the priest Abiathar, "Bring the priestly vest now."
Then David said, "LORD God of Israel, I, your servant, have heard that Saul plans on coming to Keilah and will destroy the town because of me.
LORD God of Israel, will Saul come down as your servant has heard? Please tell your servant." "Yes, he will come down," the LORD answered.
References for 1 Samuel 23:11
Next David asked, "Will the citizens of Keilah hand me and my soldiers over to Saul?" "Yes, they will hand you over," the LORD replied.
So David and his troops—approximately six hundred men—got up and left Keilah. They kept moving, going from one place to the next. When Saul was told that David had escaped from Keilah, he didn't go there.
David lived in the fortresses in the wilderness and in the hills of the Ziph wilderness. Saul searched for him constantly, but God did not hand David over to Saul.
While David was at Horesh in the Ziph wilderness he learned that Saul was looking to kill him.
Saul's son Jonathan came to David at Horesh and encouraged him with God.
Jonathan said to him, "Don't be afraid! My father Saul's hand won't touch you. You will be king over Israel, and I will be your second in command. Even my father Saul knows this."
Then the two of them made a covenant before the LORD. David stayed at Horesh, but Jonathan went back home.
Some Ziphites came to Saul at Gibeah. "David is hiding among us in the fortresses at Horesh on the hill of Hachilah, south of Jeshimon," they said.
"So whenever you want to come down, Your Majesty, do it! Leave it to us to hand him over to the king."
"The LORD bless you because you have shown this kindness to me!" Saul said.
"Go now and get everything ready. Find out everything you can: where he stays, where he goes, who has seen him. I am told he is very shrewd.
Find out every hiding place he uses there and come back to me when you know for certain. I will then go with you. If David is in the area, I will hunt him down among any of Judah's clans!"
So they got up and left for Ziph ahead of Saul. Meanwhile, David and his soldiers were in the Maon wilderness in the desert plain south of Jeshimon.
When Saul and his troops went looking for him, David was told about it, so he went down to a certain rock there and stayed in the Maon wilderness. When Saul heard that, he went into the Maon wilderness after David.
Saul was going around one side of a hill there while David and his soldiers were going around the other. David was hurrying to get away from Saul while Saul and his troops were trying to surround David and his soldiers in order to capture them.
But a messenger suddenly came to Saul. "Come quick!" he said. "The Philistines have invaded the land!"
So Saul broke off his pursuit of David and went to fight the Philistines. That's why that place is called Escape Rock.
Then David went from there and lived at the En-gedi fortresses.
References for 1 Samuel 23:29