the idea is the US is ruled by laws. when you're in US territory, you are subject to those laws. not being a citizen doesn't mean you have no rights.
then again this is the same government who says the Constitution doesn't apply 100 miles in from the border (where a significant percentage of the populace lives...)