When Defending yours or an alliance friend base or even a resource mine, all lost troops will be rescued and converted as wounded. All wounded are moved automatically and instantly at the end battle to the Civic District awaiting to be recovered. Recovering troops is much quicker and more efficient than actually retraining them from scratch. To begin recovery tap on your Civil District and select the Recover option.
You recovery is not unlimited however. There is a capacity which is improved from the Civil District. If the lost troops exceed the recovery capacity, wounded will be filled up to cap and the rest will be still considered lost.
Don't forget when Attacking other Bases or Resource Mines, all troops are lost. Your recovery crews can't get on these battlefields yet, but don't worry this will change with time.