Prisoners Of War
It was in Arab culture to make all women and children of a loosing tribe as slaves as a form of punishment on the whole tribe. After prohibition of slavery in Islam w.r.t prisoners of war, capturing varied from war to war depending upon the the particular situation of a war. In some cases, like in the case of Banu-Quraiza, majority of men were killed so children and women were made prisoners.
Please see for details : Discussion 1763