Troops will only contribute to a battle if they've been converted from reinforcements to troops that fight with the hero. If you have troops that're assigned to reinforcements, they won't be injured or killed in a battle.

You can use this to your advantage if you don't have the infirmary space to hold enough wounded and there's an attack coming in. Dismissing all of your troops will guarantee a loss, but will save your troops from being killed.

It is worth noting however that there will likely be a small number of casualties from the unassigned reinforcements, as the game puts them as working the traps and such.