I agree with Jonathan below that the Constitution (through the spending power) allows Congress to spend tax money to protect the Earth from an asteroid.
On the other hand — and at the risk of confirming Mark Kleiman in his belief that libertarians are loopy — I don’t speak for all libertarians, but I think there’s a good case to be made that taxing people to protect the Earth from an asteroid, while within Congress’s powers, is an illegitimate function of government from a moral perspective. I think it’s O.K. to violate people’s rights (e.g. through taxation) if the result is that you protect people’s rights to some greater extent (e.g. through police, courts, the military). But it’s not obvious to me that the Earth being hit by an asteroid (or, say, someone being hit by lightning or a falling tree) violates anyone’s rights; if that’s so, then I’m not sure I can justify preventing it through taxation.
Bryan Caplan once suggested the asteroid hypo to me as a reductio ad absurdum against my view. But a reductio ad absurdum doesn’t work against someone who’s willing to be absurd, and I may be willing to bite the bullet on this one.
On the other hand, if you could show that, once the impending asteroid impact became known, all hell would break loose and lots of rights be violated by looters et al. during the ensuing anarchy, I could justify the taxation as a way of preventing those rights violations; but this wouldn’t apply if, say, the asteroid impact were unknown to the public.
This does make me uncomfortable, much like my view that patents are highly useful but morally unjustifiable, so I’m open to persuasion.