Automorphisms and isometries of the quaternions

In other words, what you are asking is whether every $f\colon\mathbb{H}\to\mathbb{H}$ in $\mathit{SO}_4$ takes the form $x\mapsto \bar u x v$ where $u,v$ are unit quaternions (the connection with your notation is that then $f$ is the composition of the inner automorphism $g\colon x\mapsto \bar v x v$ with left-multiplication by $q = \bar u v$). This is a well-known fact: see, e.g., Conway & Smith, On Quaternions and Octonions (A. K. Peters 2003), §4.1.

Furthermore, this can be seen as an isomorphism $\mathit{Spin}_3\times\mathit{Spin}_3 \to \mathit{Spin}_4$ taking a pair $(u,v)$ of unit quaternions (the group of unit quaternions is isomorphic to $\mathit{Spin}_3$ acting by conjugation) to $x\mapsto \bar u x v$.


This is a standard result in representation theory:

Let the quadratic form on $\mathbb{H}$ be $\langle x,x\rangle> = x\bar x$ (which is positive definite). (Note that I am considering $\mathbb{R}$ as a subset of $\mathbb{H}$, in fact, the center of $\mathbb{H}$.) Then (because $\mathbb{H}$ is associative), for any two unit quaternions $p,q\in \mathbb{H}$ (i.e., $p\bar p = q\bar q = 1$), the linear map $f_{p,q}:\mathbb{H}\to\mathbb{H}$ $$ f_{p,q}(x) = px\bar q $$ preserves the inner product: $f_{p,q}(x)\overline{f_{p,q}(x)}=x\bar x$ for all $x\in\mathbb{H}$. Moreover, again by associativity and the fact that $\overline{xy} = \bar y \bar x$, $$ f_{p_1,q_1}\circ f_{p_2,q_2} = f_{p_1p_2,q_1q_2}, $$ so $f$ defines a homomorphism $$ f:S^3\times S^3\longrightarrow \mathrm{SO}(4), $$ where $S^3 = \{p\in\mathbb{H}\ |\ p\bar p = 1\}$. It is not hard to show that the kernel of $f$ is $\{(\pm1,\pm1)\}\simeq\mathbb{Z}_2$, and that $f$ is surjective.

This is the standard proof that $\mathrm{Spin}(4)$, the nontrivial double cover of $\mathrm{SO}(4)$, is $S^3\times S^3$.

Finally, $\mathrm{Aut}(\mathbb{H})$ is the subgroup consisting of elements in $\mathrm{SO}(4)$ that are of the form $f_{p,p}$.