2 Therefore David inquired of Yahweh, saying, "Shall I go and strike these Philistines?" Yahweh said to David, "Go strike the Philistines, and save Keilah."
*Minor differences ignored. Grouped by changes, with first version listed as example.
If Gad was with David at the forest of Hareth 1-Samuel 22:5, and there inquired for him of the Lord 1-Samuel 23:2,1-Samuel 23:4, but did not accompany him to Keilah, and if Abiathar's flight occurred at the time of David's being at Keilah, we have an additional striking instance of God's watchful providential care of David in thus sending Abiathar to supply the place of Gad at so critical a moment.
Therefore David inquired of the Lord - In what way David made this inquiry we are not told, but it was probably by means of Abiathar; and therefore I think, with Houbigant that the sixth verse should be read immediately after the first. The adventure mentioned here was truly noble. Had not David loved his country, and been above all motives of private and personal revenge, he would have rejoiced in this invasion of Judah as producing a strong diversion in his favor, and embroiling his inveterate enemy. In most cases a man with David's wrongs would have joined with the enemies of his country, and avenged himself on the author of his adversities; but he thinks of nothing but succouring Keilah, and using his power and influence in behalf of his brethren! This is a rare instance of disinterested heroism.
The Lord said - Go and smite - He might now go with confidence, being assured of success. When God promises success, who need be afraid of the face of any enemy?
Therefore David inquired of the Lord, saying, shall I go and smite these Philistines?.... For though David was well disposed to serve his country, and was desirous of freeing them from their enemies the Philistines, he might have some doubts in his mind whether it would be right for him to engage with them now; partly because he could not act under a commission from his prince, Saul the king; and partly because he had such a small number of forces with him, that it might be hazardous for him to attack the armies of the Philistines with them, and attempt to raise the siege of Keilah; and therefore he thought it advisable, as doubtless it was, to inquire of the Lord what was his mind and will in this matter: how and by what means he inquired it is not said, very probably it was by the prophet Gad, who was with him, 1-Samuel 22:5; for as for Abiathar, he was not yet come with the ephod, the Urim and Thummim, to inquire by them, 1-Samuel 23:6; though some think that is observed there to show in what way David did inquire, namely, by Urim and Thummim; and so Kimchi and Abarbinel understand it; and it is supposed that he came to David when he was about Keilah, and near unto it, and so before he came thither, and time enough for him to inquire by him whether he should go thither or not:
and the Lord said unto David, go, and smite the Philistines, and save Keilah; which was not only giving him leave to go, and signifying it was his mind and will he should; but that he should be successful, and rout the Philistines, and raise the siege of Keilah, and save the city from falling into their hands.
David inquired of the Lord--most probably through Gad (2-Samuel 24:11; 1-Chronicles 21:9), who was present in David's camp (1-Samuel 22:5), probably by the recommendation of Samuel. To repel unprovoked assaults on unoffending people who were engaged in their harvest operations, was a humane and benevolent service. But it was doubtful how far it was David's duty to go against a public enemy without the royal commission; and on that account he asked, and obtained, the divine counsel. A demur on the part of his men led David to renew the consultation for their satisfaction; after which, being fully assured of his duty, he encountered the aggressors and, by a signal victory, delivered the people of Keilah from further molestation.
After receiving this information, David inquired of the Lord (through the Urim and Thummim of the high priest) whether he should go and smite these Philistines, and received an affirmative answer.
*More commentary available at chapter level.