Can we characterize all linear maps $\mathbb{R}^{n^2} \to \mathbb{R}^{n^2} $ which map $\text{GL}_n$ into $\text{GL}_n$?
In particular, is it true that every such map is given by
$X \to AXB$ or $X \to AX^TB$ where $A,B \in \text{GL}_n$ and $X^T$ denotes the usual transpose operation on matrices.
(Note that changing the metric which respect to we are transposing amounts to changing $A,B$).
A theorem of Dieudonné [1] states the following:
So assuming $f: M_n(F) \rightarrow M_n(F)$ is a bijective linear map that maps $\operatorname{GL}_n(F)$ to $\operatorname{GL}_n(F)$, then $f^{-1}$ satisfies the conditions of the above theorem. Hence $f$ is of the form $X \mapsto UXV$ or $X \mapsto UX^TV$ for some $U, V \in \operatorname{GL}_n(F)$.
Assuming that $F$ is an algebraically closed field, by Theorem 2 in [2] if $f: M_n(F) \rightarrow M_n(F)$ is a linear map that preserves $\operatorname{GL}_n(F)$, it is nonsingular. Thus it is of the form $X \mapsto UXV$ or $X \mapsto UX^TV$ for some $U, V \in \operatorname{GL}_n(F)$.
If $F$ is not algebraically closed, the claim is false, and you can construct counterexamples using Theorem 3 in [2]. Consider for example the map $f: M_2(\mathbb{R}) \rightarrow M_2(\mathbb{R})$ defined by $$\begin{pmatrix} a & b \\ c & d \end{pmatrix} \mapsto \begin{pmatrix} a & c \\ -c & a \end{pmatrix}$$
You can check that $f$ preserves $\operatorname{GL}_2(\mathbb{R})$, but $f$ is not invertible as a linear map.
EDIT: There is also a bit more to be said. The main result of [3] you gives a classification of linear maps $f: M_n(F) \rightarrow M_n(F)$ such that $f(\operatorname{GL}_n(F)) \subseteq \operatorname{GL}_n(F)$.
In particular, Theorem 2 in [3] implies that if there exists a singular map $f: M_n(F) \rightarrow M_n(F)$ such that $f(\operatorname{GL}_n(F)) \subseteq \operatorname{GL}_n(F)$, then there exists an $n$-dimensional subspace $V$ of $M_n(F)$ such that $V \setminus \{0\} \subset \operatorname{GL}_n(F)$. The existence of such a subspace (called a full non-singular subspace) implies the existence of a $n$-dimensional division algebra over $F$. In the case of $F = \mathbb{R}$, the famous Bott-Milnor-Kervaire result implies that $n$-dimensional division algebras can only exist for $n = 1$, $n = 2$, $n = 4$, and $n = 8$. Hence we conclude the following.
Note that the example $f: M_2(\mathbb{R}) \rightarrow M_2(\mathbb{R})$ above corresponds to the division algebra $\mathbb{C}$, which is isomorphic to $$\left\{ \begin{pmatrix} a & c \\ -c & a \end{pmatrix} : a,c \in \mathbb{R} \right\}.$$
Using quaternions you can construct an example for $n = 4$, and with octonions for $n = 8$.
[1] Dieudonné, Jean. Sur une généralisation du groupe orthogonal à quatre variables. Arch. Math. 1 (1949), 282–287.
[2] Botta, Peter. Linear maps that preserve singular and nonsingular matrices. Linear Algebra Appl. 20 (1978), no. 1, 45–49.
[3] de Seguins Pazzis, Clément. The singular linear preservers of non-singular matrices. Linear Algebra Appl. 433 (2010), no. 2, 483–490.