These spawn in villages in groups of six, equipped with either an iron sword or a crossbow. They're prepared to fight any threat to the village (possibly including you!). To make new guards, shift + right click on a nitwit or unemployed villager with a sword or crossbow.

If you have hero of the village, they will gain the ability to follow and fight for you when you click the follow button, and right clicking them will open up the guard inventory, allowing you to give them armor, and swap out their weapons! For their offhand slot, you can either give them a shield, or some food. If they have a shield, they will use it to block attacks, crossbow guards with a shield won't be able to kick enemies if they're blocking. If they have food (or a potion), they will start eating or drinking if they are low on health. Clicking the patrol button will allow you to set patrol points for guards, melee guards will walk around the point while ranged guards will snipe enemies and stand still on their point.

You will only be able to gain access to their inventory if you have hero of the village.