I believe it is already not legal to ban immigrants based on religion- We can however ban someone based on their nationality IF their nationality poses a possible risk to our nation
Here is current law.
8 U.S. Code ̤̉ 1182 - Inadmissible aliens
(f) Suspension of entry or imposition of restrictions by President
Whenever the President finds that the entry of any aliens or of any class of aliens into the United States would be detrimental to the interests of the United States, he may by proclamation, and for such period as he shall deem necessary, suspend the entry of all aliens or any class of aliens as immigrants or nonimmigrants, or impose on the entry of aliens any restrictions he may deem to be appropriate