Even with the rise of heavily armoured knightly cavalry in the 11th century, the humble infantry still maintained an important role throughout the Middle Ages on both the battlefield and especially sieges.
The Crusades starting from the 11th century onward also saw a rise in the importance of infantry which required large numbers of men and material to be provisioned for and sent to distant battlefields. The infantryman was much cheaper to outfit and maintain than a knight.
By the 14th century onwards, there was a rise in the prominence of infantry forces, as the dominance of the cavalry elite began to slowly break down. The Black Death which swept through Europe in the 14th century, devastated the population and resulted in serious manpower shortages. Hence better use of available manpower was utilised by lords and kings alike.
The building of castles, sieges and constant warfare saw the elites make greater use of household troops and body guards. This greatly increased the cost of warfare for medieval regimes. The relative inexpensiveness of the infantryman, combined with a shortage of manpower, provided incentives for expanding their use.
To obtain the best professional fighting men, the elites had to make provision for their regular payment and supply. These infantry were cheaper to recruit and maintain than knights with all their trappings.
The heavily armoured, well-motivated and mounted knight still represented a formidable shock force up until the 16th century. But the increasing use of ranged missile weapons, gunpowder weapons, formidable polearms and pikes on the battlefield and sieges, as well as social, political, and monetary changes allowing the growth of larger armies, led to the infantry becoming the mainstay of any army.