I'd argue we need to do both, but that getting off-planet is actually the bigger priority: even if we run our planets poorly, we'll be safe from complete extinction, which gives us time to optimize in the long run.
Taking care of what we have right now is the bigger priority because failing that we never will get off the planet anyway.
Getting off the planet requires a larger degree of international cooperation and funding than stewarding our own planet does. If we can't manage the one we certainly won't be able to manage the other. Also, it is something that we actually can do, if we set our minds to it. Whether or not we can actually get off the planet with meaningful numbers of people to a place that is no longer tied to the earth in some critical way remains to be seen.