Infirmary allows you to recover some % (depends on infirmary level) of units for free, if your haven was raided and units got killed in that fight.
If you attack someone and lost units that can be recovered only by using rubies and fallen units will apear for 7 days in infirmary.