Chaucer likely wrote The Canterbury Tales in the late 1380s and early 1390s, after his retirement from life as a civil servant, and this is when he sets the action. This was a time of great social upheaval in England. The plague had killed a huge percentage of the population, making way for social mobility that led to class tension. In the past, medieval society had been made up of three "estates," or broad groupings by occupation: military types, religious people (like priests and nuns), and peasants. But now, a new, middle class of artisans and merchants, of which Chaucer was a part, was taking over England. Their concerns and interests, as well as the conflict between their new, more cosmopolitan way of life and the traditional values of the "three estate" society, are behind of a lot of the conflict we see in The Canterbury Tales.
Another important social issue at this time was the very lowest class's increased power. Because so many able-bodied workers had died in the Plague, farm workers could now auction off their services to the highest bidder. This meant that these members of society had more power and geographic mobility than ever before. Naturally, the landowners who paid them were unhappy about this, and tried to pass laws restricting these people's movement. The tension between these social groups may have been responsible for the hardening of negative stereotypes about lower-class people, which we see expressed in portraits of people like the Miller and Reeve.
A hugely important part of life in the medieval period was the Church (there was only one Christian church then – Protestants had not yet split from Catholicism). The Christian faith was an integral part of daily life for most people, who believed that their salvation depended upon the Sacraments, like the Eucharist and Confession, that only the Church could provide. But many controversial practices, like the selling of pardons, forgiveness from sins, or the monopoly over religious positions by members of the same powerful families, had become more and more prevalent in the late fourteenth century. In addition, rivalries between priests, who generally stayed in one parish and had their salary paid by the tithes of its members, and friars, who begged for money from the same people, had grown fierce. All of these factors led to various anticlerical stereotypes, or negative assumptions, about many religious figures. The Canterbury Tales draw upon these stereotypes and controversies in their portrayal of religious figures like the Summoner, Pardoner, and Friar.
To speak more specifically about the setting, The Canterbury Tales begin in a tavern just outside London. A tavern was one of the few places where a group of people from such varied social classes and occupations might cross paths, allowing the chance meeting of them all that leads to the creation of these pilgrims' fellowship. The same is true of pilgrimage, since members of all social classes might undertake a visit to a saints' shrine or holy place at some point in their lives, in hopes of earning forgiveness for their sins. Whether or not they would all travel together, as they do in The Canterbury Tales, is less certain, but this possibly artificial situation allows the work to explore a huge variety of medieval characters and narrative genres.