I don't see how solving poverty on earth can't be more important than the endeavor of trying with the current rather limited tech to inhabit an as good as inhabitable planet.
Space exploration is merely a _technological_ problem. Solving poverty is a _political_ problem, one that is resistant to just throwing money at the problem.
Even if we solve poverty, we can always turn right around and un-solve poverty. Something like this has happened in quite recent memory with a whole lot of other "solved" problems. Luckily, we can come back from that failure and solve those problems all over again, as long as we don't go extinct.
It depends on how you answer the question "why are we here?"
Is the goal is to create an earthly utopia with minimum suffering and maximum happiness? Is it aggressive progress so that we can't be wiped out by a random cosmic event? Or should we be eschewing all of that and living harmoniously with nature and dying spiritually content when our time is up?
There is also the argument that if we had focused on solving poverty 150 years ago instead of prioritizing rapid industrialization and economic growth more people would be in poverty today. A 50 year period of scarcity would completely erase all progress we have made towards lifting people out of poverty, regardless of how equitably we distributed the scarce goods.
It is more important. We spend > $2T per year fighting climate change. We spend > $10T per year on social welfare programs.
We spend less than $10B per year on going back to the moon and trying to inhabit Mars.