When Israel entered into Canaan, there were essentially two groups of enemies. The first was the actual cities inside the Promised Land—a barrier established by the physical boundaries in Numbers 34:1-12 and ethnically by Deuteronomy 7:1-2.
The other set of enemies were those outside this area. They were the neighboring nations that could still pose a threat to Israel, but weren’t in the strict zone that Israel was to inhabit.
(By the way, can we take a second to appreciate the fact that God is restraining the conquest? Most rulers don’t think in terms of limiting their empire; if anything, they want to make it as big as possible. David will eventually expand the nation of Israel, but, at least for now, they are to be content with the land God gives them.)
These outside nations were dealt with totally differently than the ones inside Canaan. Whereas the Canaanites were completely annihilated, God allows Israel’s neighbors to surrender. If they agree, they’ll be part of the forced labor, the environment of which God highly regulates throughout the Law.
This story is relevant when Joshua later meets the Gibeonites. These are people who live dead center in the middle of Israel, but tricked Joshua to make him think they were from far away. Because Joshua didn’t do his research, those people enjoyed the terms of surrender when they should’ve been annihilated.
If they choose not to surrender, those nations still don’t receive the same punishment as interior nations of Canaan. Instead of everyone being annihilated, the women and children are spared.
Some may take issue with this policy of destroying Canaanite nations (okay, a lot of people do), but the end of this Text tells us the why: If they don’t completely remove these nations, they could lead Israel into sin.
Essentially then, this whole process is very much do or die. Either Israel removes the temptations from their land, or the temptation removes them from the land. Those are the only two results.