It's nothing but pandering to the religious base of the Republican party. He needs their votes to become the nominee. If he becomes the nominee he will backpedal or change his mind since he will no longer need to pander to the religious base of the GOP. He already has their support, they will vote for him since they are GOP members. Core members of political parties will support their nominee in the Presidential election even if they opposed it during the nomination election. Their opposition to the Democrat party will force them to vote GOP. Trump will need the support of the independents so pandering to the religious bigotry and fear mongers of the religious base will drive them to Hillary.
The Trump rhetoric is dangerous as it just feeds the illogical fears of the illogical religious base of the GOP. Trumps ideas are logical when you look at who he is pandering to. It is illogical as a state policy so will never happen. However the idiotic base of the GOP will not understand this, hence why he is pandering. This is the problem of democracy, a moron's vote has the same value as a genius. Morons are far more common than geniuses so it is better to double down on the stupid card then to play the intelligent card.