By marriage, the husband and wife are one person in law: that is, the very being or legal existence of the woman is suspended during the marriage, or at least is incorporated and consolidated into that of the husband
(from William Blackstone's 1765 Commentaries on the Laws of England)
In other words, under common law (which is the basis of both UK and US law) in the 18th and 19th centuries, a married woman lost her legal personal identity and became an adjunct of her husband. A common way of saying this (I heard it in law school, and many unattributed variations can be found, as in Wikipedia's article on coverture) is that legally a husband and wife were one person—and that person was the husband.
The practice of calling a woman "Mrs. Husband'sFirstname Husband'sLastname" is a reflection of this legal fiction. Divorced women regained their individual identity, and so were styled "Mrs. HerFirstname Ex-husband'sLastname". It was a common practice in the 19th and first half of the 20th century:
Google Ngram comparing "Mrs. John", "Mrs. Mary",1 and "Mrs. Smith".
The Ngram suggests that the usage "Mrs. John X" came to ascension in Victorian times, and then dropped off rapidly post-WWII. However, you will still find it enshrined in some very formal etiquette advice, such as:
A widow2 is traditionally addressed as Mrs. John Jones, but if you feel the guest may not want to be addressed that way, it's completely okay to ask her how she prefers to be addressed. A divorced woman who has kept her married name should be addressed as you suggested -- Ms. Jane Johnson.
("Q&A: Invitations: Addressing One to a Widow or Divorcee?" TheKnot.com)
And it may also be used in less formal situations, either ironically or (as in the case of the Simpsons) for more straightforwardly comedic effect.
1 Note that some of the earliest examples of "Mrs. Mary X" may not refer to married women, as "Mrs." was sometimes used for unmarried women before the nineteenth century. For example, in Jonathan Swift's 1726 Gulliver's Travels we are told that the protagonist "married Mrs. Mary Burton,” second Daughter to Mr. Edmond Burton, Hosier".
2 Of course, a widow also regained her individual legal identity when her husband died; the "married" name was retained "as a courtesy". It's easier to find this tradition described for widows in modern time, however, as the high-stickler etiquette is more obvious for married women's envelopes—they are addressed "Mr. and Mrs. John Smith".