Mr. Mattis has six months to develop a plan to implement Mr. Trump’s directive, which also applies to the Department of Homeland Security, where the Coast Guard is housed.
The White House official, who spoke on the condition of anonymity under White House ground rules for the briefing, described the memo as a return to policies in place before the Obama administration moved last year to allow transgender people to serve openly in the military without fear of punishment.
The official also said that the military would no longer pay for sex reassignment surgeries unless withholding such funds would harm the health of someone already transitioning.
Mr. Trump’s directive precludes transgender people from joining the military unless Mr. Mattis, in consultation with the secretary of homeland security, “provides a recommendation to the contrary that I find convincing.”
The president surprised much of the Pentagon last month when he tweeted that the American military could not afford the “tremendous medical costs and disruption” of including transgender members.
Advocates for transgender service members vowed to push back, arguing that the president was disguising discrimination as concern for military readiness.
“Imagine, if you would, if the president tried to pull the same prank on Jewish soldiers or gay and lesbian soldiers or Chinese soldiers or African-American soldiers,” said Aaron Belkin, the director of the Palm Center, an organization that successfully lobbied in 2016 to lift the ban on transgender service in the military. “To pull the rug out from under a group of service members who have been defending our country is inconsistent with two centuries of American history.”
Mr. Trump won praise from social conservatives.
“President Trump is doing what he promised: putting the military’s focus where it belongs — fighting and winning wars,” Tony Perkins, a Marine veteran and president of the conservative Family Research Council, said in a statement. “Political correctness doesn’t win wars — and the president is ending policies that pretend it does.”
Capt. Jennifer Peace, 32, said Mr. Trump’s announcement of the ban last month prompted her to tell her new brigade commander that she transitioned three years ago — a fact that she said was not relevant until the policy change.
“The only thing that I’ve ever asked for is to be treated like every other soldier,” said Captain Peace, who has been deployed to both Iraq and Afghanistan.
She said that the ban has brought anxiety both to her family and to the unit of 70 people she leads at Joint Base Lewis-McChord in Washington State, and that the new directive fell short of allaying their concerns.
“The clarity isn’t there yet,” Captain Peace said of the memo. “How is my deployability any different from anyone else’s? I am as capable as anyone in my unit.”
Mr. Trump cast himself as a defender of gay and transgender rights during the 2016 presidential campaign. But more recently, he has sought to address the concerns of conservatives in Congress, who objected to paying for gender transition and hormone therapy for transgender service members.
The directive requires Mr. Mattis to submit a plan by Feb. 21 for implementing the new policy, including how to address transgender individuals already serving in the armed forces.
In deciding whether any transgender service personnel can stay in the military, the directive says, Mr. Mattis must weigh considerations of “military effectiveness,” “lethality” and “budgetary constraints.”
“Until the secretary has make that determination, no action may be taken against such individuals,” adds the directive.
An estimated 2,000 to 11,000 active duty and reserve troops are transgender, according to a 2016 study by the RAND Corporation.
Mr. Mattis’s plan, which is to be developed in consultation with the secretary of homeland security, is to take effect by March 23.