6th-Century England and the Late 19th Century
A Connecticut Yankee in King Arthur's Court opens and closes in modern times, which for Twain was the late 19th century. The narrator meets Hank in Warwick Castle (in the town of Warwick, England) and reads his story there. The 1800s plays a quietly important role in the book, since Hank comes from that era and, as such, it informs his point of view and critique of the Middle Ages. For example, he wants to industrialize England with factories and railroads, both symbols of the 19th century:
I had the beginnings of all sorts of industries under way—nuclei of future vast factories, the iron and steel missionaries of my future civilization. (10.1)
He also compares the slavery of Arthur's time to slavery before the Civil War:
It reminded me of a time thirteen centuries away, when the "poor whites" of our South who were always despised and frequently insulted by the slave-lords around them, and who owed their base condition simply to the presence of slavery in their midst, were yet pusillanimously ready to side with the slave-lords in all political moves for the upholding and perpetuating of slavery. (30.10)
Just as importantly, it lets Twain comment on issues of his own time, like the advance of industry and how slavery still exists, while appearing to focus on a more harmless depantsing of old Arthurian stories.
The rest of the book takes place in Merry Olde England in the 6th century, a time when men are men (in all the worst ways) and the streets are paved with mud. Mud actually plays a pretty large part in the setting, as Twain constantly emphasizes what a dump the place is—the castles are cold and drafty, and the villages wallow in filth. Hank encounters a lot of prison cells in his adventures too, which doesn't exactly add to the charm of his setting, and the peasants are always dirty and poorly dressed. It starts with the Yankee's first arrival in Camelot:
At intervals we passed a wretched cabin, with a thatched roof, and about it small fields and garden patches in an indifferent state of cultivation. There were people, too; brawny men, with long, coarse, uncombed hair that hung down over their faces and made them look like animals. (1.2)
Camelot itself serves as a contrast to all of that—as do some of the other nobles' castles—featuring beautiful trappings and well-dressed people… totally unlike life outside the castle walls. Underneath all this, of course, the nobles are a bunch of yahoos—they bet on dog fights, after all—"the men rose, sometimes, to observe it the better and bet on it, and the ladies and the musicians stretched themselves out over their balusters with the same object; and all broke into delighted ejaculations from time to time" (2.7)—and the setting helps reminds us that the difference between noble and slave can be as little as a nice jacket.
This is part and parcel of the book's satire. On one level, it dresses down the old Arthurian stories, where everyone was noble and just, and didn't act like drunk football fans whenever a dog fight broke out. On a more general level though, it pokes fun at England as a whole with its snooty aristocracy who thinks more highly of themselves than the common folk (or Americans like the Yankee).
As the story goes on, the mockery of England becomes more apparent. As Hank's efforts to improve society take root, they reflect a growing civility amongst the populace, changes that reflect their evolving intelligence en masse. Naturally, it all comes tumbling down when the Yankee gets sent back to the 19th century, and when it does, Twain gets in one last dig about how Arthurian England just can't be changed, after all.