We live in the suburbs of a spiral galaxy called the Milky Way, which sits in a small neighbourhood of galaxies called the Local Group that includes the Andromeda Galaxy. Astronomers have known for a while that Andromeda is heading towards the Milky Way, but new data from Hubble shows that it's going to hit us head-on in an epic galactic collision. On the plus side, we have 4 billion years to prepare for doomsday.
Astronomers were able to plot this future galactic meeting by using old data to make predictions. Using Hubble, they looked at the stars in the fuzzy region that extends around Andromeda's body called the halo and measured their motion over the past seven years. They were then able to extend this model to predict where the galaxy will move in the future.
Andromeda is currently 2.5 million light-years away, but thanks to the mutual gravity of the two galaxies and the dark matter that surrounds them, it's moving towards us at a rate of 60 miles per second (100 kilometers a second for you metric folks). Currently barely visible to the naked eye in the Norther hemisphere, Andromeda will gradually get brighter over the next 4 billion years. Once the galaxies get within a certain range of each other, the real fun will begin; their mutual gravity will start pulling them apart before they physically collide.
The Milky Way and Andromeda are about the same mass, so their effects on one another will be significant. Stars on the outskirts of both galaxies will be drawn out into long tails of stars and gas that will be flung outward in anticipation of the collision.
It will take a hundred or so million years before the two galaxies will physically collide. On a galactic scale, stars are so small and far apart that the odds of two colliding or getting close enough to affect their respective solar systems are incredibly small. But the gas clouds that make up a lot of a galaxy's mass are huge — multiple light-years across. There's no way the dust from Andromeda and the Milky Way won't collide.
The two dust clouds will crash into each other, collapsing and forming new stars. This will light up the gas clouds; if you could get a distant vantage point you would see strings of glowing red gas extending from the galaxies' arms.
Meanwhile in the heart of the collision, stars will be thrown into different orbits around their new galactic center. Simulations show that our solar system will probably be tossed much farther from the galactic core than it is today.
The two galaxies will pass right through each other and they're pulled apart. But their momentum won't be enough to carry them past one another. Gravity will take over and pull the post-collision mass back together. The settling period will last about 2 billion years. When the chaos Andromeda and the Milky Way will have combined into a new, and much larger, single elliptical galaxy.
Luckily for our million-times-great grandchildren, this will all happen before the Sun meets its own demise. Barring some planetary collision, the Earth might still be around, too. Stars will be thrown around the galaxies as they collide, and it’s likely that the Sun and our Solar System will be thrown to a point much farther from the new galactic core than it is today. That may be a good thing since the Milky Way and Andromeda have supermassive black holes in their centres. These black holes will merge in the collision, and it's still unclear how this will affect all the matter that orbits around them.
Wherever Earth ends up in this new supergalaxy, the merger is sure to be quite a show. If you want to watch it, I suggest working the kinks out of your cryogenic freezing apparatus soon. Or just watch some awesome computer simulations.