He believes that the biggest risk to humanity is that we're currently all on one planet. This means global warming, nuclear war, pandemics, zombies, etc, could basically wipe out humanity.
If he can get humans living on Mars, that means that destroying life on a planet no longer destroys humanity, and that is a very significant levelling up to human survival. Getting people to Mars, to learn how to settle permanently there is a first step. Getting re-usable rockets is a first step even before that. Most things related to SpaceX that Musk does are essentially steps on the path to making this happen.
He may or may not be on the right track, and even if it's a good idea he might be doing it the wrong way, but everything is consistently focused around making this happen. For this, further developing the mid-west, terraforming Arizona, or colonising the bottom of the sea are all insufficient to achieve the goal.