Chapter thirty tells us that David conquered the Amalekites and captured their captives.
The Amalekites had conquered Ziklag and burned it and captured all the women, including the families of David's men and his two wives (vv. 1-6a).
The soul of all the people was bitter, and they spoke of stoning David, but he "strengthened himself in Jehovah his God" (v. 6b). Following this, he told Abiathar the priest to bring the ephod to him, and he inquired of Jehovah, saying, "Shall I pursue after this band? Will I overtake them?" Jehovah said to him, "Pursue, for you will certainly overtake them, and you will certainly deliver them" (v. 8). Then David and four hundred of his men pursued the Amalekites, with the assistance of a young man of Egypt who was a servant of an Amalekite. The provision of the help from this Egyptian indicates that the details of David's environment were under God's sovereignty. Eventually, David conquered the Amalekites and captured their captives, delivering all that the Amalekites had taken. "Nothing was missed by them, neither small nor great, neither sons nor daughters, neither spoil nor anything that they had taken; David brought everything back. And David took all the flocks and the herds, which they drove before the other cattle and of which they said, This is David's spoil" (vv. 19-20).
David shared the spoil with the two hundred men who had not been able to follow him in pursuing the Amalekites (vv. 21-25). Concerning this David said, "As his share is who goes down to the battle, so shall his share be who stays by the baggage; they shall share alike" (v. 24). From that day forward David made this a statute and an ordinance for Israel (v. 25).