The Medieval Walls are the second-stage upgrade to city defenses, providing additional defense that attackers need to defeat before assaulting the city (or Encampment) itself. They are much more elaborate than Ancient Walls, capable of withstanding more advanced medieval weapons, and even some Catapult bombardment.
What is interesting about them is that they provide +2 Housing for the city, when your Government is Monarchy. Note that this bonus continues to be valid after you develop Civil Engineering! On the other hand, cities which haven't constructed Medieval Walls will not get the bonus upon developing that Civic, and won't have the chance to get it anymore, since you cannot construct City Defenses anymore once Civil Engineering is completed!
Historical Context Edit
From the Latin castellum, a castle is designed to protect the important people (and maybe those who serve them) from their enemies. Surrounded sometimes by moats and mottes, often with palisades and baileys and enceinte, usually with a central keep for when things really went wrong, the great castles were the last refuge during times of troubles. From the walls and towers the dedicated defenders could hurl death down upon the attackers … who, if they were smart, simply laid siege to the pile until those inside starved and sensibly surrendered. Historians are not quite sure (hardly surprising) when castles as such arose, but most attribute the development to an evolution of the walls around lordly homes to protect such from the likes of the Magyars. Muslims and Vikings in the 9th and 10th centuries AD. Proven Roman engineering techniques were adapted to make these outposts of civilization as nigh impregnable as possible. And, in time, royalty decided they might need some in their cities as well, for when the peasants started revolting. Worked well enough, until those peasants had gunpowder.