Not only is that comment a false dichotomy (we can both explore space
and make humanity more sustainable at the same time), it also presumes that space exploration and sustainability are at odds with one another and not synergistic.
Humans, simply by existing on Earth, have a huge and often negative impact on the environment. If we could somehow shift the human population off Earth, either by terraforming planets (like Mars) or creating artificial space habitats, it would have a huge positive impact on Earth's environment. We don't currently have the technology to do so - we would need space elevators to feasibly move humanity off Earth - but that doesn't mean we should move our attention away from space in the meantime.