Whenever you win a battle your men captured will be freed.

The same goes for the enemy. That is why you have to execute every single enemy when all your men have routed from the field.