In the Middle Ages, they divided their society into those who worked, those who fought, and those who prayed. People like the peasants and craftsmen would work, knights would fight, and the clergy would pray. The church came first as the first estate, the nobility was in the second, and the peasants were in the third. Medieval people had a very strict social order, and it was thought to be natural and the way God wanted it.
In the 11th and 12th centuries thinkers argued that human society consisted of three orders: those who fight, those who pray, and those who labor. The structure of the second order, the clergy, was in place by 1200 and remained singly intact until the religious reformations of the 16th century. The very general category of those who labor (specifically, those who were not knightly warriors or nobles) diversified rapidly after the 11th century into the lively and energetic worlds of peasants, skilled artisans, merchants, financiers, lay professionals, and entrepreneurs, which together drove the European economy to its greatest achievements. The first order, those who fight, was the rank of the politically powerful, ambitious, and dangerous. Kings took pains to ensure that it did not resist their authority. By the 12th century, most European political thinkers agreed that monarchy was the ideal form of governance. This was because it imitated on earth the model set by God for the universe; it was the form of government of the ancient Hebrews and the Christian Biblical basis, the later Roman Empire, and also the peoples who succeeded Rome after the 4th century. (Wikipedia)
The estates started to break down when merchants started to come up and start a new class between the peasants and the nobles. Merchants developed their own cities and had their own guilds.