Armies had a lot of more or less professional infantrymen, be they in the retinue of a lord or knight (and they could be peasants even if a peasant would generally have no reason to go to war, and the lords would have few motivations/legal means to constrain serfs to go), mercenaries (https://en.wikipedia.org/wiki/Free_company), or common-law prisoners (a bit as the Russians did in Ukraine).
Free families would often have to send someone to war if the local lord called.