Are Pokemon training in a gym damaged?

Solution 1:

Yes, after training at a Pokégym, if your Pokémon takes any damage, they will need to be healed. Note, if your Pokémon loses, he will faint and need to be revived.

source: personal experience

Solution 2:

Yes you do need to heal your pokemon after training in a Gym. The lowest they can go down is to 1 hp if it is your own team's gym while they can faint in an opposing faction's team which is when you need to use revive. Personal experience.