Scarcity of habitable planets is absolutely solvable with technology - space ships, stations etc. Sufficiently advanced technology may also allow people to switch to more efficient bodies, or upload their consciousness to computers, or simply different forms designed for 'uninhabitable' worlds, or space itself.