Astronomers estimate that, in around 3 billion years time, our galaxy (the Milky Way) and the Andromeda galaxy will collide, potentially causing a merging of the two galaxies. It is not 100 % certain that this will happen, and our knowledge will only develop with continual observation of the motion of Andromeda.

If they were to collide, it would not necessarily entail destruction of the solar system. And besides, by that point in time, the temperature of the sun would have increased beyond the point where humans could survive on earth.