Indeed, Mr. Trump, like all Americans, has his First Amendment Rights.  To my knowledge, no one has suggest otherwise.  The Court decisions have referenced his comments since they support the argument that the travel ban was, indeed, aimed at a specific religious group.  We all have "freedom of speech".  However, our comments do, in fact, have consequences.  Mr. Trump rather frequently says or tweets things which have negative consequences for him.  It's rather perversely amusing to watch Sean Spicer as he attempts to explain, justify or "walk back" such comments.  

If you had publicly stated you were a Communist, then later received "secret" clearance, I'm guessing either a) the authorities granting such clearance did not discover your statement or b) you successfully convinced them the statement was not a true expression of your views.  The lawyers for Mr. Trump had that same opportunity as they attempted to defend the travel ban.  Gary Crum