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.

“I’ve had great support from that community,” Mr. Trump said. “I got a lot of votes.”

He said the military is “working on it now,” adding that “I think I’m doing a lot of people a favor by coming out and just saying it.”

The president did not elaborate on exactly what “it” was. But in announcing the ban in three July 26 tweets, Mr. Trump said that the military could not afford the medical costs of supporting transgender people. He also said transgender personnel made it harder for the military to focus on “decisive and overwhelming victory.”

The president’s announcement drew sharp criticism from L.G.B.T. advocates. This week, two gay rights groups filed a lawsuit to halt the proposed ban before it takes effect. The lawsuit, filed on behalf of five transgender women who are now serving openly, says a ban would violate the women’s constitutional rights.

Defense officials said Mr. Trump’s announcement two weeks ago took them by surprise. Jim Mattis, the defense secretary, was told about the president’s decision only the day before it was posted on Twitter. Shortly after, Gen. Joseph F. Dunford Jr., the chairman of the Joint Chiefs of Staff, the military’s highest ranking officer, said in a statement that current personnel policy would remain until the White House and the defense secretary formally issued new guidelines. Mr. Mattis has not yet spoken publicly about the issue.

One administration official said the White House was considering urging transgender service members to retire early. But a defense official, speaking on the condition of anonymity, said on Thursday that doing so might be difficult to defend in court.