Unitary Operators on Let $L^2_{\mathbb{P}}(\Omega)$ be a separable Hilbert space and $(\Omega,\Sigma,\mathbb{P})$ be a probability space.  Given two $f,g \in L^2_{\mathbb{P}}(\Omega)$ is there a unitary (or self-adjoint) operator $U$ on $L^2_{\mathbb{P}}(\Omega)$ satisfying
$$
U(f)=g\qquad \mathbb{P}-a.e?
$$
For a unitary operator you will need the condition $\|f\|=\|g\|$. W.l.o.g. assume $\|f\|=\|g\|=1$. Extend $f$ to an orthonormal basis $\{f_1,f_2,...\}$ with $f_1=f$ and extend $g$ to an orthonormal basis $\{g_1,g_2,...\}$ with $g_1=g$ and define $U(\sum a_n f_n)=\sum a_n g_n$. This gives  a unitary map with $Uf=g$.
Let $\phi:\Omega \rightarrow \Omega $ be a bijective measurable function preserving the $\mathbb{P}$-size of each set; ie:
$$
\mathbb{P}\left(
\phi^{-1}(B)
\right)=\mathbb{P}(B)\qquad (\forall B \in \Sigma).
$$
Then the composition operator $C_{\phi}:f\mapsto f\circ \phi \in L\left(L^2_{\mathbb{P}}(\Omega)\right)$ (where $L(L^2_{\mathbb{P}}(\Omega))$ is the set of continuous linear maps from $L^2_{\mathbb{P}}(\Omega)$ to itself) is unitary.  

Well-defined



Using the push-forward property of measure
$$
\int_{\Omega}|C_{\phi}f|^2d\mathbb{P} = 
\int_{\Omega}|f\circ \phi|^2d\mathbb{P}=
\int_{\phi(\Omega)}|f\circ \phi|^2d\phi_{\#}\mathbb{P}=
\int_{\Omega}|f\circ \phi|^2d\mathbb{P}&lt;\infty;
$$
where $\phi_{\#}\mathbb{P}$ is the $\phi$-push-forward of $\mathbb{P}$.

Unitary:
Let $f,g \in L^2_{\mathbb{P}}(\Omega)$ and note that:
$$&lt;C_{\phi}f,g&gt; = \int_{\Omega}f\circ \phi g d\mathbb{P}=
\int_{\Omega}f g\circ \phi^{-1} d\mathbb{P}=
&lt;f,C_{\phi^{-1}}g&gt;;
$$
whence $C_{\phi}$ is unitary with adjoint $C_{\phi^{-1}}$!

Similarly, we compute that: $C_{\phi}\circ C_{\phi^{-1}}=C_{\phi^{-1}}\circ C_{\phi}=1_{L^2_{\mathbb{P}}(\Omega)}$.

A Fun Little Example...But and important One: The Fourier Transform



The Fourier Transform $f\mapsto \int_{\omega \in\Omega} e^{-2 \pi \lambda \omega} f(\omega) d\mathbb{P}(\omega)$ is a particularly important case.   I leave this exercise to you though 

Then as Kavi stated, you just need to choose $\phi$ that maps $f$ into $g$.