The question of what we do with people who aren't American citizens is a different issue. I agree with UncleJD; Trumps's plan is idiotic, unhelpful, and would set an awful precedent. But in terms of legality, the Supreme Court has ruled that unadmitted and nonresident aliens have no Constitutional right to entry (Kleindienst v. Mandel). Don't get me wrong, I think it's an idiotic idea, but it's not illegal to arbitrarily ban unadmitted and nonresident aliens from the United States, even in a way that is not equally protective.