Which linear maps $\mathbb{R}^{n^2} \to \mathbb{R}^{n^2} $ map $\text{GL}_n$ into $\text{GL}_n$? 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: A theorem of Dieudonné [1] states the following:

Let $F$ be a field and $f: M_n(F) \rightarrow M_n(F)$ be a bijective linear map such that $\det A = 0$ implies $\det f(A) = 0$. Then there exist $U, V \in \operatorname{GL}_n(F)$ such that either $f(X) = UXV$ for all $X \in M_n(F)$, or $f(X) = UX^TV$ for all $X \in M_n(F)$.

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.

Let $f: M_n(\mathbb{R}) \rightarrow M_n(\mathbb{R})$ be a linear map such that $f(\operatorname{GL}_n(\mathbb{R})) \subseteq f(\operatorname{GL}_n(\mathbb{R}))$. If $n \not\in \{2,4,8\}$, then $f$ is bijective and there exist $U, V \in \operatorname{GL}_n(\mathbb{R})$ such that either $f(X) = UXV$ for all $X \in M_n(\mathbb{R})$, or $f(X) = UX^TV$ for all $X \in M_n(\mathbb{R})$.

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. 
