Can anybody explain to a layman like me why American law (equal protection clause) would apply to foreigners?
In this case, the court ruled that the State of Hawaii as a whole, on behalf of its residents, as well as an individual Muslim Hawaiian who is an American citizen, would be harmed by the discriminatory EO as a result of its interference with their relationships with family and friends who are non-citizens overseas. The courts are tying the cases to the harm caused to American citizens and states that are acting on behalf of their residents by discrimination against Muslim non-citizens rather than ruling that Muslim non-citizens themselves are protected by the Constitution.
While courts are not taking this route because they do not have to do so, it would be quite arguable that equal protection under the 5th Amendment due process clause applies to non-citizens in any case. The 14th Amendment equal protection clause says: "nor shall any state ... deny
to any person within its jurisdiction the equal protection of the laws." No mention of citizens, just "persons." While equal protection is not explicitly included in the 5th Amendment, it has been read to be included in the 5th Amendment's guarantee of due process, which, once again, does not specify citizens: "No
person shall be ... deprived of life, liberty, or property, without due process of law." Taken literally, that applies to non-citizens with just as much force as it applies to citizens.