Federal law states people cannot be denied entry to the United States purely on the basis of their nationality.
precisely stated, what the Immigration and Nationality Act states is: "Except as specifically provided in paragraph (2) and in sections 101(a)(27), 201(b)(2)(A)(i), and 203, no person shall receive any preference or priority or be discriminated against in the issuance of an immigrant visa because of the person's race, sex, nationality, place of birth, or place of residence."
"Paragraph 2" talks about the per-country quotas. 101(a)(27) is for "Special Immigrants" (think unaccompanied minor refugees). 201(b)(2)(A)(i) sets aside visas immediately for spouses, children, and parents of U.S. citizens (if parents, the U.S. citizen has to be 21 or older - anchor babies are a myth). 203 outlines preference categories for family members and employment-based cases.
so, for at least persons seeking immigrant visas (looking to live in the U.S. permanently), Congress has said that the government cannot discriminate against immigrants on the basis of race, nationality, and/or place of birth, except under the sections specifically broken out.
Trump's problem is that he publicly stated the ban is against "muslims" and against persons of specific nationalities or places of birth. he is on record both pre-campaign and during presidency.
the INA DOES permit the government to bar persons who will cause harm to the U.S. from entering. but that is an entirely different issue than what the Trump admin is doing here.