Monarchs commanded the statehood & nationalism
Prior to the concept and implementation of 'nation-state' during modern periods (starting with Napoleonic times from a Western/European perspective), the monarchs were styled as the sovereign and they represented the state. In many ways, they were the state. Thus, the monarchs were the symbols of nationalism and incited popular support in their favour against the opposing forces, even when/if they were ruthless to their own population.
Representatives of their religion
In many cases, religion also played an important role. Monarchs/rulers styled themselves as representatives of their respective religions or propagated their appointment to rulership as religiously 'sanctified.'
Political Authority
The monarchs also had the right to regulate and accumulate national wealth. They also had the right to delegate political authority or take it away from the nobilities. The nobles in pre-modern times commanded armies. To achieve political and financial favours from the monarchs they would pledge their loyalties and armies (& themselves served as commanders).
Battlefield Command
One of the key motivations for forces to support their monarchs was the fact that the monarch, their family members, & subordinate nobilities would take part in warfare alongside the population and soldiers. Presence of 'elite commander of authority' has been an important motivational factor and, in fact, continues to be in some form or the other. In modern times when the soldiers of the platoon see their commanding officers leading from the front and risking their lives for the nation-state and for the platoon itself they automatically find the motivation to fight. This is perhaps one of the reasons that Middle Eastern armies today do not perform as the armies from other states like Turkey, Pakistan, etc.
War Booty
In the end, war booty mattered a lot. Given the level of poverty during the medieval time, people perhaps found war as a means of acquiring something for their survival. Otherwise, they were bound to die of hunger anyway.
Wages
While the armies of older times were not standing armies in the sense of what we have today they nonetheless received wages. Everyone doing their duties.