WASHINGTON — President Trump said on Thursday that he is doing the United States military a “great favor” by barring transgender people from serving in its ranks — even though the Pentagon has made no move to expel personnel since the commander in chief first tweeted the policy about-face two weeks ago.

The White House has yet to make public any formal guidance on how the Defense Department is supposed to turn Mr. Trump’s Twitter posts into policy. Last year, many transgender service members came forward after being assured by the Obama administration that they could serve openly in the military. Pentagon officials have said privately that they do not see how to expel current service members, or bar future ones from joining the military, without opening the Defense Department up to lawsuits.

“It’s been a very confusing issue for the military, and I think I’m doing the military a great favor,” Mr. Trump said during an impromptu news conference at his golf club in Bedminster, N.J.

He declared that he has “great respect” for lesbian, gay, bisexual and transgender people and denied that his ban amounted to a betrayal after pledging to protect them during last year’s campaign.