If a town was sacked and it's population enslaved by an invading force like in biblical times, how were the fates of these new prisoners decided? who is assumed to be the owner of these slaves and how would they transport them to markets? would the individual soldiers be entitled to any, or would they have to buy them from someone? would random slavers tag along on the average military campaign? Would an independent buyer purchase the bulk of them from the leader of the army and distribute them elsewhere? how many would actually make it to a permanent labor position in a home or on a farm?
This question is a big too vague, since 'ancient' accounts for a timespan of thousands of years. Different polities handled this differently. Is there one in particular you were interested in knowing about?
From an ancient Roman perspective, the general would decide the division of spoils: how much to the men, how much to the state. The army would often be followed by merchants who'd sell food to supplement the rather basic provisions but also buy up things like slaves. I believe slavers would follow the army as well in anticipation.
I'm trying to remember which campaign ended with the anecdote (I believe it's from Livy) that so many slaves were sold off afterwards it depressed the market.
Edit. Found the incident. It was actually in 406 CE when the Romans under Stilicho soundly defeated Radagaisus and an invading Gothic army and that the "slave markets are said to have collapsed under the flood of captives for sale" (from Theodosius: Empire at Bay).