The Philistines had either brought their cattle out of their land, or had taken from the Israelites in their march, for the sustenance of their army.
Related Commentaries of 1 Samuel 23:5
1 Samuel 23:5
5 So David and his men went to Keilah, and fought with the Philistines, and brought away their cattle, and smote them with a great slaughter. So David saved the inhabitants of Keilah.