The first time DC and Marvel ever crossed the threshold between Universes was the giant-sized comic Superman vs The Amazing Spiderman published in 1976. This giant-sized monstrosity (which I remember buying as if it were the Holy Grail) was the first such official sanctioned crossing of the two mainstream continuities. Yes, it was a completely ridiculous farce where Superman and Spiderman engage in superheroic combat (with Spiderman being enhanced by Red Sun radiation, so he could bring the pain to Superman). My favorite scene is when Superman pulls his punch, stopping millimeters from Spiderman's face, as the radiation which was giving Spidey an edge wears off and Spiderman is blown backward down the street and through a building by the wind shear of Superman's punch. Great fun. The villains of course are Lex Luthor and Doctor Octopus.
Marvel's heroes for the most part existed within their same universe, but were not known to cross into each other's stories except for books like Marvel Team-up or other such books designed to showcase two heroes who might not otherwise meet to work together. Quality of such stories varied (but I did love them just the same). The Marvel Universe was very segmented early on, but once Marvel discovered how much readers enjoyed team-ups and crossovers, you could expect at least one a year, usually in the Avengers, whose lineup at one point boasted over fifty members.
Marvel did have one opportunity to create alternatives to their characters using the What If storylines. What If was a book designed to take pivotal storylines and posit an alternative ending to them. These were very popular and eventually lead to the Marvel version of the Multiverse where Marvel worlds were slowly given numerical designations so writers could keep up with what happened in that alternative timeline. The mainstream Marvel Universe is number 616.
DC on the other hand had a much more difficult time with its alternative universes (called the DC Multiverse). No, I don't plan to go into the horror that is the early DC Universe, enjoy the Wikipedia link for the whole sorted tale. Early in their publishing career, they bought up many smaller concerns and had to deal with their separate worlds. The Shazam Family was one such purchase. It stayed separated from the mainstream DC universe (back then the mainstream universe was called Earth 1). The Shazam Family lived on Earth S and had little interaction with the Earth 1 continuity. When DC decided to migrate away from what were considered the Golden Age Heroes (the first versions of Superman, Kal-L, Batman, Green Lantern (Alan Scott) and the Flash (Jay Garrick) to more modern (scientific) versions of the characters, the Golden Agers were relegated to the universe called Earth 2.
As readers, we are only privy to the transformation during a comic called The Flash of Two Worlds, where we are informed that there are two continuums in place. The modern world of comics, called the Silver Age in the 1960s and an earlier world where its around 1950 with the earlier versions of all our favorite DC heroes. Many are famous, some were not, but their most famous iteration was the Justice Society, from which the idea of the Justice League was based.
This continuity crossover was so popular it became a yearly event in the DCU between the Justice Society and the Justice League and DC would experiment with many of their parallel worlds and products during this time. This unfortunately would lead to the Crisis on Infinite Earths, where DC would try to bring all of their products together on a single world in a single timeline with a cataclysmic event that collapsed all of the known Earth continuities together onto a single world. This ended badly.
There were several attempts to clean this up over the next two decades resulting in the latest iteration of the DCnU called the New 52. This collection of 52 universes is now the reality of the DCnU. It is assumed any stories that are wanted can be made or told somewhere within those 52 universes and those tales will be considered canon. Room to experiment and the opportunity to reboot the DCnU one more time, resetting all clocks, erasing all unwanted characters (mistakes, continuity glitches, retcons and story problems such as the Legion of Superheroes which suffered terribly under all of the Universe resets) and recreating the DCU hopefully for the last time. But we know better.
This is not to say there have not been successful alternative universe projects, particular with DC. Two of their best known graphic novel collections are from an alternative universe, Kingdom Come, a dystopian future where superheroes become the rulers of a frightened populace, and Red Sun, a world where Superman is raised in the Soviet Union and becomes a weapon of the state. Marvel's Days of Future Past spawned dozens of related continuities and alternative versions of heroes, and the Age of Apocalypse where an entire timeline became temporarily, the mainstream reality for a time, and can still affect the mainstream universe. It has remained its own timeline Universe #295.
In the end, Marvel still kept its Multiverse of numerically assigned worlds with two of them being considered the primary real estate of the MU. There is Universe 616 known as the Mainstream Universe. All stories told unless otherwise informed, are taking place in that universe and with all of its attendant realms (Asgard, the Negative zone and other such places) and the Ultimate Marvel Universe (a more modern reboot of the Marvel Universe, from which the Marvel Universe movies are based) numbered 1610. There are many other timelines in the Marvel Universe, for a list you can consult Wikipedia's Multiverse entry for the Marvel Universe.
DC has collapsed their entire Multiverse into a single hyperconnected continuum of universes, 52 to be exact, but we have seen very little of any of the other universes besides the primary DCnU. Rumor has posited we will be seeing an alternative world featuring a differently dressed Power Girl and Huntress team, and a Black Superman.
The only thing you can be sure of with comics and their mutable universe structures is there will be things that the writers/editors won't like and when enough of them happen, there will be rectons (rewriting of the comic universe so events did not happen) or movements of those moments to other parallel worlds where the idea can be experimented with.