Even though Saul was wicked, he was still human and was touched by David's word and repented (vv. 21-25).
Saul admitted that he had sinned, acted foolishly, and made a very great mistake (v. 21).
Saul said to David, "Blessed are you, my son David. You shall most certainly both do and prevail" (v. 25). However, Saul did not say anything about the kingship or kingdom, because he still wanted his son Jonathan to succeed him as king.
"David said in his heart, I will now one day perish at the hand of Saul. There is nothing better for me than to escape into the land of the Philistines; then Saul will despair of seeking me any longer within all the territory of Israel. Thus I will escape from his hand" (27:1). After realizing this, David and his men crossed over to Achish (vv. 2-3).
Because David had escaped into the land of the Philistines, Saul ceased to seek him (v. 4). Saul felt that he was at peace because David had gone out of the holy land. This indicates that David had done the right thing in leaving the holy land temporarily.
David stayed in Ziklag (27:528:2). According to verse 7 he stayed in the land of the Philistines a year and four months. During that time he attacked and destroyed the Geshurites, Girzites, and Amalekites, but he pretended before King Achish that he attacked the south of Judah (vv. 8-12).
In 28:1-2 we are told that Achish made David his bodyguard for life.