David wanted to fight with the Philistines against the Israelites (but the Philistines wouldn't let him)
1 Now the Philistines gathered together all their armies to Aphek: and the Israelites pitched by a fountain which is in Jezreel.
2 And the lords of the Philistines passed on by hundreds, and by thousands: but David and his men passed on in the rereward with Achish.
3 Then said the princes of the Philistines, What do these Hebrews here? And Achish said unto the princes of the Philistines, Is not this David, the servant of Saul the king of Israel, which hath been with me these days, or these years, and I have found no fault in him since he fell unto me unto this day?
As the Israelites and Philistines were preparing for war, some of the Philistines were wary of David and his men.
They said to king Achish,
What are these Hebrews doing with us?
King Achish said,
This is David, the servant of Saul, who has been with me for some time now.
He's done nothing to concern me.
4 And the princes of the Philistines were wroth with him; and the princes of the Philistines said unto him, Make this fellow return, that he may go again to his place which thou hast appointed him, and let him not go down with us to battle, lest in the battle he be an adversary to us: for wherewith should he reconcile himself unto his master? should it not be with the heads of these men?
5Is not this David, of whom they sang one to another in dances, saying, Saul slew his thousands, and David his ten thousands?
But that didn't satisfy the Philistine princes. They said to Achish,
Send him back to the city you gave him. 
Otherwise, when we go into battle he'll cut off the heads of our soldiers to reconcile himself with Saul.
Isn't this the guy the dancing girls sang about, saying, "Saul slew his thousands, and David his ten thousands?"
6 Then Achish called David, and said unto him, Surely, as the LORD liveth, thou hast been upright, and thy going out and thy coming in with me in the host is good in my sight: for I have not found evil in thee since the day of thy coming unto me unto this day: nevertheless the lords favour thee not.
7 Wherefore now return, and go in peace, that thou displease not the lords of the Philistines.
So King Achish had to tell David that he couldn't go with them to kill Israelites because the Philistine lords didn't trust him.
8 And David said unto Achish, But what have I done? and what hast thou found in thy servant so long as I have been with thee unto this day, that I may not go fight against the enemies of my lord the king?
David was disappointed. He said to Achish,
I've always been willing to fight against your enemies.
9 And Achish answered and said to David, I know that thou art good in my sight, as an angel of God: notwithstanding the princes of the Philistines have said, He shall not go up with us to the battle.
10 Wherefore now rise up early in the morning with thy master's servants that are come with thee: and as soon as ye be up early in the morning, and have light, depart.
I know. You're an angel to me.
But the Philistine princes will not fight with you.
11 So David and his men rose up early to depart in the morning, to return into the land of the Philistines. And the Philistines went up to Jezreel.
So David and his men returned to the land of the Philistines.
And the Philistines went to fight the Israelites.