Troops built in a city with a barracks start life hardened. Troops stationed there double their health each turn until reaching 100%, which is a distinct improvement on the 20 percentage points increase that applies to a unit with over 20% but under 80% health in a city with no barracks. (The matching facilities for air units and naval units are Airport and Dockyard.)
In just one of each nation's cities, the barracks may be replaced by a Military Academy, which costs more to build and maintain but produces elite troops; the barracks are automatically sold. If you sell the academy (either directly or by completing one in another city), the barracks do not automatically reappear but must be built if you want them.