The point of colonizing Mars (for Musk) is not to move there when Earth becomes inhabitable. It's too remove the single point of failure for the species that Earth currently represents.
With a self-sustainable (even if harsh) Mars colony, a nuclear war on Earth no longer necessarily means the end of humanity.