It doesn't make sense from a military perspective to ban transgender service members.  Trump tweeted it to shore up the homophobic sector of his base of supporters, which also includes racists, xenophobes, Islamophobes, and sexists.