As most people know Donald Trump proposed a temporary banned on Muslim travelers to the U.S. Question I have is what makes this policy legal or illegal.
The Due Process Clause of the 5th Amendment prohibits the federal government from discriminating. Since Bolling v. Sharpe, a Supreme Court decision that desegregated schools in Washington D.C., the 5th Amendment's Due Process Clause has been read to imply a guarantee of equal protection under the law -- the same guarantee the Equal Protection Clause of the 14th Amendment requires of the States.
First, it is worth pointing out that the relevant clauses do not apply only to citizens, but to persons in general. This isn't a distinction that reads too much into the text of the Amendments. In fact, the word "person" in the 14th Amendment is used to define who becomes a citizen of the United States. This would hardly make sense if the amendment didn't apply to non-citizens. Furthermore, the court subjects alienage classifications to heightened scrutiny; in other words, the court will tend to be suspicious of discrimination on the basis of citizenship, again confirming that guarantees of equal protection aren't exclusive to citizens.
It is also worth pointing out that the guarantee of equal protection has special force in the case of religious minorities. There are two reasons for this. First, freedom to exercise one's religion is expressly guaranteed by the First Amendment, which begins with the following:
Congress shall make no law respecting an establishment of religion, or prohibiting the free exercise thereof
Therefore laws that are discriminatory, and are discriminatory on the basis of religion, are already in violation of two Constitutional principles. However, one might question the scope of the equal protection clause; after all, nearly every law discriminates in some way against some people. For example, laws prohibiting murder discriminate against murderers.
This is why, in Footnote 4 of the majority opinion for US v. Carolene Products Co., the court clarified the issue. The court noted that, though it would generally show deference towards Congress' decisions, there were some areas in which it would be more suspicious of legislation. The relevant text is as follows:
There may be narrower scope for operation of the presumption of constitutionality when legislation appears on its face to be within a specific prohibition of the Constitution, such as those of the first ten amendments, which are deemed equally specific when held to be embraced within the Fourteenth.
It is unnecessary to consider now whether legislation which restricts those political processes which can ordinarily be expected to bring about repeal of undesirable legislation, is to be subjected to more exacting judicial scrutiny under the general prohibitions of the Fourteenth Amendment than are most other types of legislation.
Nor need we inquire whether similar considerations enter into the review of statutes directed at particular religious or national or racial minorities: whether prejudice against discrete and insular minorities may be a special condition, which tends seriously to curtail the operation of those political processes ordinarily to be relied upon to protect minorities, and which may call for a correspondingly more searching judicial inquiry
In short, the Constitution's guarantees of equal protection under the law prohibit the government from discriminating; this guarantee applies to non-citizens as well as citizens, and it applies with special force with respect to classifications based on religion, ethnicity, or national origin.