False. Mattis was relieved of command of USCENTCOM under 0bama for asking about second and third order affects of 0's stance toward Iran and showing 0 et al their folly. He was passed a message by his deputy
Mattis was appointed as SECDEF under Trump - the transgender nonsense was already in place. Since then, the military has moved to ban most transgenders (I think the exception is those already undergoing "treatment", and only until they finish such "treatment").
Which, as another poster has mentioned, things in the bureaucracy move slow....it's a lot harder to undue something than it is to just stroke a pen and say - ok the freakshow is welcome.
He has made statements supportive of the transgender nonsense, even if he did not implement it.