Marvel created the What If? concept in 1977 either as a direct riposte to or at least a general acknowledgement of DC's infamous "imaginary stories". Imaginary stories had been popular specifically because they allowed for more freedom than that accorded in the context of static serial adventure stories - instead of ensuring that all the toys were replaced at the end of the story, the imaginary offshoots allowed the creators the occasional opportunity to blow everything up without any regard for consequences. As a result, the imaginary stories were often more memorable than most of those set in conventional continuity.
What If? was created with the same logic in mind. Telling out-of-continuity stories is a source of endless fascination for creators and fans alike. Marvel and DC, as superhero universes, were uniquely suited to take advantage of this storytelling device for two reasons. First, both of the companies' adventure continuities were large and well established to the degree that feasible "alternate universe" stories could find significant purchase. This almost goes without saying, but a small or limited milieu - regardless of its popularity - will not create sufficient material for successful "imaginary stories". Milieus like, say, Lost or the Indiana Jones films - despite their sci-fi pedigrees - simply aren't big enough - too focused - for alternative stories to make any kind of sense.
Secondly, and perhaps more importantly, the sci-fi / fantasy framework creates a milieu wherein these type of metafictional devices can be readily understood and appreciated. To the best of my knowledge no television soap opera has ever tried a "What If?" scenario because - despite the fact that many long-running soaps have labyrinthine continuities to rival any superhero universe - the idea of an alternate universe, or even just an imaginary story, is too far removed from the basic milieu. Soaps occasionally traffic in unusual storylines - devil possession, superheroes - but the idea of alternative universes is probably far too convoluted for such a (relatively) naturalistic genre. Likewise, there will never be a "What If?" 24 or imaginary Gilmore Girls - both shows have deep milieus, but outside of the realm of fan-fiction, little to no relationship with any kind of sci-fi / genre tropes.
Long-running sci-fi and fantasy universes seem to inevitably spawn alternate universes, by virtue of the nature of sci-fi / fantasy fandom. It simply isn't that big of a leap to ask Buffy fans to deal with shifting reality - such as retroactively inserting characters into the milieu, or traveling to alternate Sunnydales. Buffy could play around with that kind of metatext because the audience could be expected to understand it. Likewise, Star Trek has dealt with parallel universes since almost the beginning of the franchise, and the explosion of ancillary continuity has only exacerbated the trend. Almost every Star Wars story not told on film by George Lucas probably counts as an "alternate universe", on account of Lucas' hard line regarding the canon's composition (last I checked, only the six films, their respective novelizations, and the Clone Wars material is big "C" canon). But even within this framework, Dark Horse published a series of explicitly "What If?" Star Wars stories a few years back - stuff like, "What If Luke Hadn't Blown Up the Death Star?", from what I recall.
It's worth pointing out that Dr. Who has perhaps the friendliest relation to alternate universes of all the long-running sci-fi properties. Because the show's 45-year continuity is so incredibly dense, continuity is customarily changed, ignored or massaged at will for the purposes of current stories. It drives fans wild, but the BBC's official policy of laissez faire continuity has the most powerful logic behind it: Dr. Who is a show about time travel, and that means everything about it can change or be changed simply by recourse to the series' primary plot device; and anyway, keeping continuity straight is the fans' job, anyway. One interesting result of this is that Dr. Who fans tend to take their ancillary novels very seriously.
(To my second point, it's worth mentioning just how rare "alternate universe" stories are in TV or film. People have a far easier time extending their suspension of disbelief to cover fantasy worlds and future realms than alternate universes, to judge from the genre's track record. Sure, there are one-offs like Sliding Doors and The Family Man - not to mention It's A Wonderful Life - but considering their prevalence in nerd culture, it would make sense to see the alternate universe device used more freely in the wider culture. It can be an effective storytelling tool whenever it's utilized - I saw an episode of the Boondocks cartoon a few years ago that dealt with the question of what Martin Luther King, Jr. would do if, instead of having died in 1968, he had been in a coma for forty years and woke up today. It was one of the best episodes of the series I've seen. Why is it that no one has ever tried to make any kind of "real world" "What If?" How about, "What If the Allied Invasion of Normandy Failed?" That could be an entirely different kind of fantasy franchise, a la those enduringly popular Harry Turtledove books that the military historians geek out over - but perhaps people would complain of bad taste? But I degress.)
In any event, the creation of alternate universes seems almost inevitable for any long-running serial genre fiction milieu. DC's "Imaginary Stories" began appearing in the late 50s*, at just a little bit over the two-decade point for Superman's ongoing publication (not coincidentally, around the same time that parallel worlds were explicitly introduced to DC titles via "The Flash of Two Worlds"). What If? appeared 16 years after the publication of Fantastic Four #1. There would appear to be some kind of correlation between the age of a milieu and the propensity towards alternate universes - at some point, a universe reaches a "critical mass" where alternate universe stories can exist, and at which point the audience is eager to read them. The Ultraverse didn't last long enough for a "What If" to make sense, neither did any incarnation of Valiant or the Charlton heroes. But at some point someone at Marvel - I don't know for certain but I'm going to guess Roy Thomas since he wrote and edited the first issue of What If? - figured that the Marvel Universe could support the format.
As to "Elseworlds", Wikipedia actually offers a very good definition with which to begin the discussion:
Unlike its Marvel Comics counterpart What If...?, which bases its stories on a single point of divergence from the regular continuity, most Elseworlds stories instead take place in entirely self-contained continuities whose only connection to the canon DC continuity are the presence of familiar DC characters.*This isn't a hard-and-fast rule in all cases - there are any number of "Elseworld" stories that could easily have been labeled as What If? stories, and likewise, there are more than a few issues of What If? that present less in the way of specific departures and more general analogues. As a general rule, however, "Elseworlds" tend to present analogue worlds instead of alternate worlds. The difference is: you can write a story where Spider-Man joins the Fantastic Four at a specific point, and then make a story about all the ways in which the new universe deviates from the previous one - a story told with the tacit understanding that up to the exact moment the divergence occurs, the alternate universe is predicated on the exact same attributes as the original.
An "Elseworlds", however, is built less on individual divergences than general analogues or conceptual reboots. For instance - what if Superman's spaceship landed not in 20th century Kansas but King Arthur's Camelot? Or the jungles of Africa? Or what if Kal-El's spaceship had been found by Thomas and Martha Wayne? Superman is a great character for "Elseworlds" because it's possible to take that simple premise and tweak it in so many different ways. But instead of telling stories wherein the rest of the DC Universe continues on normally and interacts with these divergence, the analogues usually transplant the familiar situations into the new, local milieu. For instance, if Superman lands in Camelot, there's going to be a black knight with the family name Luthor, and a local princess with the name of Lane, or something to that effect (I can't remember exactly how that one went).
But more interesting, to me at least, were those "Elseworlds" which acted like What If? The Nail was a great book that acted just like a What If? storyline: the question was, "What If Superman Had Never Appeared?" The story assumed that everything else in the DC Universe would be normal, except that without Superman everything would fall apart - because Superman is the proverbial nail that holds everything together. (I'm trying not to give away the ending, but it does manage to answer the question of just why Superman was absent in an extremely satisfactory manner.) They did a one-shot where Batman was made Earth's Green Lantern in lieu of Hal Jordan - again, a straight-forward divergence predicated on the acceptance of established continuity.
In some instances, it's a fine line, and getting at the exact difference or definition of specific stories is unimportant. For instance, is the Dark Knigth Returns more an "Elseworlds" or a What If? It does take conventional continuity as its point of divergence, but where's the actual point of divergence? It doesn't really matter what the answer is, it doesn't affect the story one bit. But I would argue that, historically, most "Elseworlds" stories have been - at best - superfluous, more an exercise in artistic license than anything else - i.e, wouldn't it be cool if Batman had lived in Victorian times? Most stories that begin with a root divergence for Superman, for instance, no matter how alien the milieu in which they place the character, usually end with Kal-El become Superman on the last page. Most often the message can be boiled down to something along the lines that "the more things change, the more they stay the same", because the heroes' core attributes never changes regardless of the milieu.
That's just not very interesting. Marvel's 1602 had more or less the exact same problem. It wasn't really a What If?, although there was a half-hearted attempt at creating some kind of concrete divergence in the last issues. It was a story about analogues: what if the Marvel Universe got jump-started some 350 years earlier? Essentially, you'd end up with a different Peter Parker who still acted like our Peter Parker; a different Nick Fury who still acted like our Nick Fury; a different Fantastic Four that still acted like our Fantastic Four; etc., ad naseum. What was the point? I don't even think it was even a particularly bad story, such as it is, I just failed to see the point. Unless you get a kick out of seeing, say, Daredevil in Renaissance drag, what’s the point? You know they're going to end in more-or-less the same kind of status quo that their present-day counterparts share. Neil Gaiman loves Elizabethan lore and wanted to do a Marvel story - but it really isn't anything more than Neil Gaiman doing an Elizabethan Marvel story.
A What If?, however, can upend the whole apple cart. A good What If? should follow the logic of its premise to the most ruthless ends: not only can Spider-Man die, he often dies. Not only can the heroes fail to save the world, sometimes the world even gets blown up. Even when things change for the better, it's usually still bittersweet. One of the early stories of the series' second volume was built on the idea of Wolverine joining S.H.I.E.L.D. instead of the X-Men. It's a crazy story because, in that universe, everything that went wrong in the mainstream milieu went right. Wolverine fits into S.H.I.E.L.D. like a hand in glove, they work together to save the day, Dark Phoenix is prevented, the Sentinels never return, anti-mutant hysteria is quashed. It's not a very complicated premise, but it exploits the possibilities of What If? to the hilt: that was a story that could never have been told in the regular milieu, and yet telling the story illuminates certain essential aspects of the core concepts that might otherwise have gone underplayed. In that instance: Wolverine is a rough-neck punk in the context of the X-Men, at-odds with the team dynamic and mission; but, put into a more copasetic context, he finds a much more effective role than that of a mere bruiser in a second-rate superhero team, and is allowed to effect great positive change on a much larger scale. The end result is that Wolverine's character is enriched through telling a story that doesn't "mean" anything, but nonetheless complements established continuity.
Next: Finally, I'll get around to discussing Kingdom Come. Sharpen your knives.
* From what I was able to gather from Google the "first" Imaginary Story is "Mr. and Mrs. Clark (Superman) Kent" from Lois Lane #19, August 1960. If I am wrong please correct me.