Where It All Goes Down
Welcome to the Catholic city of Vienna, which is under the fictional reign of Duke Vincentio. In the play, Vienna is a place of sexual depravity, where brothels are a dime a dozen and citizens run amok, thumbing their noses at Vienna's laws.
In Measure for Measure, all the brothels in Vienna's suburbs are scheduled to be torn down because prostitution is illegal and the spread of venereal disease is out of control. When we read this, we can't help but think of the suburbs outside of Shakespeare's London, where the sex industry thrived because it was hard for officials to regulate brothels outside the city limits. In fact, in April of 1604 (the same year Shakespeare wrote Measure), King James I ordered all the tenements and houses in the suburbs be torn down to prevent the spread of the plague, which killed about 36,000 people in 1603 alone!
In contrast to the suburbs are the more religious settings, such as monasteries and nunneries. Interestingly, in 1538, Henry VIII (the English king who broke with the Catholic Church) began the dissolution of all the monasteries and convents in England. This eliminated an important option for women who would seek life as nuns. By the time Shakespeare wrote Measure for Measure around 1604, there weren't any left. There were, however, plenty of them in Vienna (the seat of the Holy Roman Empire). Maybe that's part of why Shakespeare decided to set his play in Vienna.
On a more general level, literary critic Marjorie Garber points out that the world of the play is chock full of cramped and claustrophobic spaces: a nunnery, a monastery, a dungeon, a farmhouse surrounded by a moat, and so on. Garber goes on to argue that each of these confining spaces "is imaginatively a sign of a set of other enclosures: virginity and chastity; brotherhood and obedience; even death" (Shakespeare After All, 568).