During emergencies, you can arm civilians in order to defend impending attacks. Residents are summoned from their buildings and are ordered to defend.
Militia do not get trained in the barracks. Instead, they can be enlisted for 3 hours from your Farm. During this time, resource production is lowered by 50% but a number of militia are recruited to defend your village. After the 3 hours are up, resource production returns to normal.
The amount of militia recruited depends on farm level and Research. For every farm level, you receive 10 militia (or 15 with the city guard research). This is capped at level 25 (meaning that the maximum amount of militia is 375). This militia remain militia for 3 hours before returning to their work. Militia cannot be used to attack other villages.
One advantage of using militia is that, even if they are killed, you do not lose the population. Another is that if they are killed by an attacking player, they do not earn any BP from killing them. However, opponents can tell your farm level just from the amount of militia you have.