The planet they crash land on has portals into the future where a future Will and a mutated Dr. Smith are the only survivors. Future Will used the remains of the ship to build a time machine. He plans to go back in time to the day the ship took off and stop it, saving the family, but destroying the Earth in the process. Future Smith betrays Future Will and tries to go back himself. John stays behind to kill Future Smith while Major West, Will and Smith make it back to the ship. John kills Future Smith and saves Future Will from dying himself. The Jupiter 2 takes off with the family (sans John), but gets crushed by a falling asteroid. Future Will resets his time machine and sends John back to seconds before, so he can save his family. Future Will stays behind as the planet explodes. The Jupiter 2 makes it off the planet, but is about to get sucked into a black hole. They activate the hyperdrive, this time charting a course. The movie ends before we see where they end up.