As some may know, the Milky Way galaxy and the Andromeda galaxy are closing together and will “collide” in something like 4 – 5 billion years. If you are a good distance away, say in a Magellenic Cloud, this would look really spectacular, but what about if you were on a planet like Earth, right in the middle of it, so to speak? Probably not a lot of difference from what we see. There could be a lot more stars in the sky (and there should be if you use a good telescope) and there may be enhanced light from a dust cloud, but basically, a galaxy is a lot of empty space. As an example, light takes 8 minutes and twenty seconds to get from the sun to Earth. Light from the nearest star takes 4.23 years to get here. Stars are well-spaced.
As we understand it, stars orbit the galactic centre. The orbital velocity of our sun is about 828,000 km/hr, a velocity that makes our rockets look like snails, but it takes something like 230,000,000 years to make an orbit, and we are only about half-way out. As I said, galaxies are rather large. So when the galaxies merge, there will be stars going in a lot of different directions until things settle down. There is a NASA simulation in which, over billions of years, the two pass through each other, throwing “stuff” out into interstellar space, then they turn around and repeat the process, except this time the centres merge, and a lot more “stuff” is thrown out into space. The meaning of “stuff” here is clusters of stars. Hundreds of millions of stars get thrown out into space, many of which turn around and come back, eventually to join the new galaxy.
Because of the distance between stars the chances of stars colliding comes pretty close to zero, however, it is possible that a star might pass by close enough to perturb planetary orbits. It would have to come quite close to affect Earth, as, for example, if it came as close as Saturn, it would only make a minor perturbation to Earth’s orbit. On the other hand, if that close it could easily rain down a storm of comets, etc, from further out, and seriously disrupt the Kuiper Belt, which could lead to extinction-type collisions. As for the giant planets, it would depend on where they were in their orbit. If a star came that close, it could be travelling at such a speed that if Saturn were on the other side of the star it could know little of the passage.
One interesting point is that such a galactic merger has already happened for the Milky Way. In the Milky Way, the sun and the majority of stars are all in orderly near-circular orbits around the centre, but in the outer zones of the galaxy there is what is called a halo, in which many of the stellar orbits are orbiting in the opposite direction. A study was made of the stars in the halo directly out from the sun, where it was found that there are a number of the stars that have strong similarities in composition, suggesting they formed in the same environment, and this was not expected. (Apparently how active star formation is alters their composition slightly. These stars are roughly similar to those in the Large Magellenic Cloud.) This suggests they formed from different gas clouds, and the ages of these different stars run from 13 to 10 billion years ago. Further, it turned out that the majority of the stars in this part of the halo appeared to have come from a single source, and it was proposed that this part of the halo of our galaxy largely comprises stars from a smaller galaxy, about the size of the Large Magellenic Cloud that collided with the Milky Way about ten billion years ago. There were no comments on other parts of the halo, presumably because parts on the other side of the galactic centre are difficult to see.
It is likely, in my opinion, that such stars are not restricted to the halo. One example might be Kapteyn’s star. This is a red dwarf about eleven light years away and receding. It, too, is going “the wrong way”, and is about eleven billion years old. It is reputed to have two planets in the so-called habitable zone (reputed because they have not been confirmed) and is of interest in that since the star is going the wrong way, presumably as a consequence of a galactic merger, this shows the probability running into another system sufficiently closely to disrupt the planetary system is of reasonably low probability.