That is basically the plot of the 1933 sci-fi classic novel "WHen Worlds Collide"...........
https://en.wikipedia.org/wiki/When_Worlds_Collide
LOL
Many Sci-fi writers expressed ideas about things that were later developed and occasionally ideas about conditions later found to be true. They also missed the mark on the second part sometimes.