It's hard to answer this as it's not focused on one particular group. Medieval forces were rarely uniform (English being a notable exception) as most soldiers provided their own equipment, which gave formations an interesting mix match of whatever a person could afford and what they could train with.
Generally nobles and elites (knights) made up around 20% - 30% of an earlier medieval fighting force, although this number declined steadily and late medieval forces were lucky to be 5% of the noble knight makeup. The other 70% were a varying mix of peasants to men at arms that would enter the army through a variety of methods.
Knighthood was somewhat from birth, but a good deal of it was due to accomplishments, with those accomplishments often being proven on a battlefield. Men during this time would often be inspired to change their and their families fortune by taking it at the end of their sword and would enlist for fame and a bit of pay. If they proved their worth, in an accolade ceremony https://en.wikipedia.org/wiki/Accolade they could become knights, though in the end they were often doing it simply for pay. This setup was more Enlgish in nature and arguably the first professional military setups. Squires and other classes that served a knight would often find themselves in this position after their service had ended.
However this is Feudal society and not everyone was allowed the choice of a military career and were often forced into it by status. In most other nations, the men-at-arms were drawn from a Gentry class (french gentil hommes). A Feudal lord would designate vassals who were land holders in their own right. These land owners would fund themselves (equipment) and made up a good section of the ranks of an army. Their service guaranteed their (and their familys) status as land holders in exchange for the obligation of military service. These vassals could also enforce rules upon the people whom lived on the land they were given, and these rules would often include 1 person per household in active military service (often a peasant levy). This form of military service is often referred to as obligation.
However this model was proven ineffective repeatedly and failed to provide the standing army a nation would desire. In times of peace, this setup caused some degree of social upheaval as well (mostly related to pay or lack there of). Knights services were often in 40 day terms, but extended military campaigns disrupted that as well. Simply put, Obligation worked well in early Feudal times, but as cities and population developed, this model would become obsolete as it was highly inefficient.
When you start reaching later medieval, the concept of obligation was being replaced by a bunch of...we'll call it 'adhoc'...processes that saw some obligation, but more and more a paid standing military force. Very much inspired by the 100 year war, the concept of gendarmes came to be (English 'Yeoman' would fit in the same category I beleive). Through a series of ordinances, these gendarmes evolved into paid companies of men that would be stationed in cities (by this time, knight participation had fallen to around 1% of the total military force). This model would evolve many times and eventually provide become standard practice for modern militaries.