Units that were hit in battle are recorded as “wounded” and will go to your Sickbay. You can’t use them for attacks, and they won’t defend you until you heal them in the Sickbay.
If your Sickbay can’t hold more units, all other affected units will die and be recorded as “killed” in the battle. So make sure you always treat the wounded in the sanctuary in order to save your units, so they can join your army again.
A Sickbay can be build, when your Keep reached level 9.