This Q&A site already has several questions regarding traveling to other galaxies than in the main setting.
What has been the first work where somebody has visited at least two galaxies beyond their own in the same plot?
This Q&A site already has several questions regarding traveling to other galaxies than in the main setting.
What has been the first work where somebody has visited at least two galaxies beyond their own in the same plot?
1934: "The Living Galaxy", a short story by Laurence Manning, first published in Wonder Stories, September 1934, available at the Internet Archive.
The story is framed as a history lesson for children in the distant future:
Close your eyes and picture to yourself a classroom of children about six years of age. You are one of these children. You have a book open in front of you and, as you read it, a lecturer says the words of it out loud, so that the subject matter is impressed through ear as well as eye. The date is very far in the future — more than 500,000,000 years, and the sun, Earth, Mars, Venus, and other ancient things have long since died and become as forgotten and legendary as the Garden of Eden. You, at the age of six, have played with strange toys — toys that would puzzle a skilled engineer today. You look forward to a whole century of study, research, sport, amusement, and philosophy. This first century is your childhood and it will end when you go to the great hospital to be operated upon and made bodily young once more. After that you are grown up and set about doing your work in the world — in whatever world you please, as a matter of fact, for there are billions of planets to choose from. You expect to live in this way forever, except for the risk of accidents. There is no hurry about learning or doing anything — but at six you are curious and ill-informed and this is the very first time you have been given any insight into the history of the human race, its habitations and its physical limits.
The instructor tells how a planetoid was converted to a starship and sent on a mission to investigate and deal with a threat far off in space:
Just at the time when the human race was engrossed in possibilities of new exploration in distant galaxies and universes, with thousands of huge rocket- ships under construction, astronomers reported in alarm a violent "shift to the red" in one area of the sky. As all of you have had toy spectroscopes, you know what this means. Over an area ten degrees of arc across, the star background seemed to be flying apart at terrific speed — hundreds of times faster than anything ever observed. As the centuries passed, it was seen that a void was being created where once stars had been. A great black empty area thrust its way down toward the First Universe which then contained all the human race. It was like a vast cone, point down, and in it there appeared to be nothing — absolutely nothing. Beyond it the blank space extended to infinity and not even the most powerful telescopes showed any trace of distant stars.
As the years passed, it was seen that the cone's point would at its present rate touch the First Universe in a few more millions of years. Yet what action could be taken? Most scientists were resigned to the rôle of mere observers. Not so Bzonn!
He gathered together a dozen scientists — twelve men and women whose names are now unknown. They settled upon an uninhabited planetoid circling a small sun — a tiny planet not quite one hundred miles in diameter — and busied themselves in secret preparations. Atomic motors of huge size were constructed and the entire core of the planet scooped out and its stone transformed into metal. From the center, great rocket tubes flared out to the surface — fifty miles away — and the entire planet was in a few centuries made into a rocket ship. A mile below the surface they made themselves living quarters and were ready to start. The voyage they planned was, in those days, incredible. So much fuel would be needed that only a ship of planetary dimensions could have contained it and it would have been absurd to construct such a vehicle. The whole planet was set under motion by earth-shaking blasts from the great rocket chamber and the voyage commenced. Its purpose was no less than to explore the edge of space and investigate the force that was driving the stars apart. Consider this at a time when the longest flight had been less than a thousand years! After the fashion of those days of naming everything, the planet-ship was named the Humanity
They visit many galaxies and establish colonies along the way:
It must not be thought that the opportunity for charting the galaxies was neglected. A small mountain of photographs was prepared during the four million years. Progress was made in every phase of art and science. It is regrettable that the colonization idea was not thought of until a million years had elapsed. This consisted of breeding a hundred humans and thoroughly educating them, stopping the Humanity in her course, entering a galaxy and finding a planet, and then leaving the hundred colonists on it to multiply and explore their new universe. This was done, Bzonn reports, more than one hundred and seventy times in the last three million years of the voyage.
Short Answer:
I don't know.
Long Answer:
Part One: Skylark Series.
E.E. Smith's second skylark novel, Skylark Three, was serialized in Amazing Stories August, September, and October 1930.
In it the protagonists discover that the Fenachrone species is plotting to conquer the entire galaxy and exterminate all other intelligent beings, so they commit genocide against the Fenachrone first. Discovering that one Fenachrone ship left the galaxy to seek refuge in some distant galaxy, they pursue them across vast distances of space in the Skylark III.
If I remember correctly, the ships attack each other at distances of hundreds of millions of light years, so they should have traveled billions of light years during the pursuit and they must have passed galaxy after galaxy after galaxy, before the Fenachrone ship was finally destroyed.
In the sequel, Skylark of Valeron, originally serialised in Astounding Stories August 1934 to February, 1935, the protagonists are exploring intergalactic space while they are still far from their own galaxy when they are attacked. When it becomes clear that the Skylark III will eventually be destroyed, they get in the much smaller Skylark II, brought along as a lifeboat, and send it into another dimension.
The protagonists eventually returns to their original dimension an unknown distance from where it left. Entering a new galaxy and a new solar system, they find the human natives of the planet Valeron being attacked by alien chlorine breathers. and help defeat the "Chlorans". Then they build a Death Star sized spaceship, the Skylark of Valeron, to contain the gigantic astronomical instruments they need to find their own galaxy from gazillions of light years away.
So by 1934-35 the Skylark series involved exploring our own galaxy, a small part of another dimension with different physical laws, and also in our dimension the very distant galaxy where the planet Valeron was. But I don't know if that counts for the purpose of the question.
Part Two: Lensman Series.
In Gray Lensman, first serialized in Astounding Science Fiction from October 1939 to January, 1930, the Lensmen respresent the government that rules most of our galaxy. Gray Lensman Kimball Kinnison deduces that the forces of Boskone are invaders from another galaxy, which must be the one known as Lundmark's Nebula (probably not, repeat not, the same as the galaxy known as Wolf-Lundmark Melotte https://en.wikipedia.org/wiki/Wolf%E2%80%93Lundmark%E2%80%93Melotte[1]).
Kinneson later leads an expedition to Lundmark's Nebula or the Second Galaxy to search for the headquarters of Boskone.
So our Milky Way Galaxy and the Second Galaxy are the settings of various parts of Gray Lensman. Since it is believed by the characters that those two galaxies are the only two galaxies to have billions of solar systems with planets in all the universe, there is very little motive for any characters to visit other galaxies during the Lensman novels. In the prequel novel First Lensman (1950) one of the protagonists hopes to someday visit The Large Magellanic Cloud to see S Doradus close up, and that is the closest to a visit to a third galaxy in the Lensman series that I remember.
Part Three: Interstellar Patrol Series.
Edmund "World Wrecker" Hamilton's Interstellar Patrol series novel Outside the Universe first appeared in Weird Tales July to October 1929. In it the Interstellar Patrol defends our galaxy against invaders from another galaxy, who of course needed to explore a second galaxy outside their own, namely our Milky Way Galaxy, in order to invade it. But I don't remember if those aliens explored and invaded any other galaxies, or if any other galaxies were explored or visited by beings from our galaxy.
Part Four: How Old is the Concept of Other Galaxies?
Zeiss Icon wrote:
Both the Skylark series and the Lensman series covered multiple galaxies. Given how late it was learned that "galaxy" wasn't a singular object comprising the entire universe (they were originally called "island universes"), this can't go back before about the 1930s, so Doc Smith and Skylark might well be the first.
Actually I am not sure that three or more galaxies (counting two external ones) were explored in either the Skylark or Lensman series during the 1930s. And the concept of "island universes" or other galaxies was known long before their existence was proved in the early 1920s.
William Hope Hodgson's novel The House on the Borderland (1908) begins with the discovery of the diary of an 18th century man in the ruins of an old house. Most of the novel consists of the 18th century man's diary records of his strange experiences there. And almost the only detail I remember is the 18th century man speculating whether some nebulae could be external galaxies.
And for years I thought that obviously it was possible for a writer in 1908 to think that maybe some of the nebulae were external galaxies, because Hodgson mentioned that idea. But I wondered whether any 18th century man like the one in the novel could have wondered whether some nebulae could be external galaxies. And eventually I learned there were speculations about that as early as the 18th century.
In 1734, philosopher Emanuel Swedenborg in his Principia speculated that there may be galaxies outside our own that are formed into galactic clusters that are minuscule parts of the universe which extends far beyond what we can see. These views "are remarkably close to the present-day views of the cosmos."[39] In 1745, Pierre Louis Maupertuis conjectured that some nebula-like objects are collections of stars with unique properties, including a glow exceeding the light its stars produce on their own, and repeated Johannes Hevelius's view that the bright spots are massive and flattened due to their rotation.[40] In 1750, Thomas Wright speculated (correctly) that the Milky Way is a flattened disk of stars, and that some of the nebulae visible in the night sky might be separate Milky Ways.[31][41]
https://en.wikipedia.org/wiki/Galaxy#Distinction_from_other_nebulae[1]
So a late 18th century man could have learned of the concept that some nebulae might be other galaxies, or might have thought of it himself.
So theoretically someone could have written fiction about exploring two or more external galaxies as early as 1750.
Part Five: Inconclusive Conclusion.
Thus it is possible that stories involving the exploration of not just one external galaxy but two or more external galaxies, could have been published in a pulp science fiction magazine sometime before "The Living Galaxy" by Laurence Manning in 1934, mentioned in the answer by user14111. User14111 obviously has far more expertise than me in early science fiction stories, but I don't know if that story is the actual first one about exploring multiple galaxies.
The first pulp science fiction was Amazing Stories founded, in 1926. And science fiction stories were also published in Weird Tales, founded in 1923, and in general interest magazines and as novels both before and after 1926.