On Friday, the White House issued a memo to the Department of Defense with formal guidance on the ban, weeks after the president tweeted about it — seemingly surprising military officials and Congress.
"The military must be focused on decisive and overwhelming victory and cannot be burdened with the tremendous medical costs and disruption that transgender in the military would entail," Trump tweeted in July.
Now, with Mattis' directive in hand, the Pentagon has six months to prepare before the ban is implemented.
ABC News breaks down what is known about the ban thus far.
What does Trump's formal policy guidance say?
The memo Trump signed on Friday formally directed the Pentagon to bar transgender individuals from openly serving in the U.S. military and gave the DOD six months to develop an implementation plan, which will go into effect on March 23, 2018.
The basis for Trump's directive was "national security considerations," according to a senior White House official.
"In my judgment, the previous Administration failed to identify a sufficient basis to conclude that terminating the Departments' longstanding policy and practice would not hinder military effectiveness and lethality, disrupt unit cohesion or tax military resources, and there remain meaningful concerns that further study is needed to ensure that continued implementation of last year's policy change would not have those negative effects," Trump's memo reads.
Trump's guidance effectively returns the Pentagon to its policy before June 2016, when then–Defense Secretary Ash Carter allowed transgender individuals to serve openly and permitted the funding of gender transition treatments and surgeries.
Carter gave the Pentagon one year to study how to allow transgender individuals to join the military — referred to as accession.
This June, Mattis extended that study through January 2018. The White House memo will extend the ban indefinitely, until "such time that the defense secretary recommends against the contrary," the White House official said.
The Department of Defense is directed to stop gender-transition-related surgeries — with exceptions for individuals whose procedures are underway, to protect their health.
As for transgender individuals currently serving, an official would not outline the factors that Mattis could consider in arriving at a DOD policy regarding them, leaving open the possibility that some transgender service members could keep their jobs.
How has the Pentagon responded?
Mattis said Tuesday that transgender service members will continue to serve in the military while the Pentagon conducts a study of how to implement Trump's directive.
In a statement, Mattis said he will establish a panel of experts from the Defense Department and the Department of Homeland Security "to provide advice and recommendations on the implementation of the president's direction."
"Panel members will bring mature experience, most notably in combat and deployed operations, and seasoned judgment to this task," said Mattis. "The panel will assemble and thoroughly analyze all pertinent data, quantifiable and nonquantifiable."
He said he would provide advice to Trump on how to implement the policy after the panel arrives at recommendations. "In the interim, current policy with respect to currently serving members will remain in place," said Mattis.
How many transgender service members are in the military?
The Pentagon does not track how many transgender service members there are in the military, but about 250 service members were either transitioning genders or had changed their gender in personnel records.
A 2016 Rand study, commissioned by the Department of Defense and cited by Carter last summer, estimated there might be 1,320 to 6,630 transgender service members on active duty.
What do previous studies say about transgender service members?
The Rand study looked at the effects of integration efforts of foreign militaries and determined "little or no impact on unit cohesion, operational effectiveness or readiness."
"Policy changes to open more roles to women and to allow gay and lesbian personnel to serve openly in the U.S. military have similarly had no significant effect on unit cohesion, operational effectiveness or readiness," Rand said.
When asked on Friday how much was spent on transgender-related medical procedures over the last year, a senior U.S. official referred questions to the Pentagon.
The Rand study estimated extending gender-transition–related health care coverage to active duty transgender service members would increase health care costs "by between $2.4 million and $8.4 million annually, representing a 0.04 to 0.13 percent increase in active-component health care expenditures."
Who's pushing back against the ban?
There are at least three lawsuits challenging the constitutionality of Trump's ban.
The first was brought Aug. 9 by GLBTQ Legal Advocates & Defenders and the National Center for Lesbian Rights, representing five active-duty transgender service members.
On Monday two additional lawsuits were filed by the Human Rights Council, represented by Lambda Legal and OutServe-SLDN, and the ACLU.
Asked on Monday about these lawsuits, Pentagon spokesman Col. Rob Manning said he would not comment on ongoing litigation.
Additionally on Tuesday, 140 members of the House of Representatives wrote a letter to Trump urging him to reconsider his "ill-advised and indefensible" ban.
"Transgender service members wear the same uniform and complete the same missions as their cisgender peers," the letter reads. "In combat, their lives are in equal peril. They serve with equal distinction; they are equally deserving of our gratitude and respect."