Actually many countries will ban people from entering their country because of what they have said or done in another country.
The UK has banned certain Americans from entering the UK before.
List of people banned from entering the United Kingdom - Wikipedia, the free encyclopedia
Stephen "Don" Black, racist, white supremacist, runs Stormfront. The UK doesn't want this sort of person in. The BNP wanted this sort of person in, the govt didn't allow him.
Preston Wigginton doesn't appear on this list, but he got banned for the same reason.
Erich Gliebe, white supremacist.
Mike Guzovsky, Israeli militant.
Plenty of people the UK govt deems inappropriate to come into the UK.
So the reality is it wouldn't set any precedent at all, the UK govt has done it before and will do it again. Even Mike Tyson's on this list.
Trump is making remarks that are not to the liking of a lot of British people. If the British people choose to ban him for what he has said, then this is consistent with the law.
Banning a whole religion based on the actions of other people in the religion is, however, not consistent with much, certainly not with the constitution.