Moroni achieved his objective of liberating the prisoners, and of increasing his ranks with the men who had been captured. The women and children were certainly sent away from the front lines, and they would have been put to work with the rest of the population in tending the fields and providing the logistical support for Moroni’s army.
The Lamanite prisoners are used as slave labor in Gid, just as they had been in Mulek. As long as Moroni had to feed them and guard them, he has them perform the labor of creating new defenses for Gid, thus being of use in the Nephite defense rather than simply a drain on food reserves.