Which battle are you referring to?
edit: Perhaps the Battle of the Trench.
If so, your comment is misleading. The Jews were forced into a surrender after having betrayed their former muslim allies in favour of the confederates.
From wiki article (https://en.wikipedia.org/wiki/Battle_of_the_Trench) :
"Following the retreat of the Confederate army, the Banu Qurayza neighbourhoods were besieged by the Muslims, in revenge for their treachery. After a 25-day siege of their neighbourhood the Banu Qurayza unconditionally surrendered. When the Banu Qurayza tribe surrendered, the Muslim army seized their stronghold and their possessions.[29] On the request of the Banu Aus, who were allied to the Qurayza, Muhammad chose one of them, Sa'ad ibn Mu'adh, as an arbitrator to pronounce judgment upon them. Sa'ad, who would later die of his wounds from the battle, decreed the sentence according to the Torah, in which the men shall be killed and women and children enslaved.
Deuteronomy 20:10-14 says:
When you march up to attack a city, make its people an offer of peace. If they accept and open their gates, all the people in it shall be subject to forced labor and shall work for you. If they refuse to make peace and they engage you in battle, lay siege to that city. When the Lord your God delivers it into your hand, put to the sword all the men in it. As for the women, the children, the livestock and everything else in the city, you may take these as plunder for yourselves. And you may use the plunder the Lord your God gives you from your enemies. [30]
Muhammad approved of this decision, and the next day the sentence was carried out."