  A relativistic quantum harmonic oscillator in 3+1 dimensions is derived from
a quaternionic non-relativistic quantum harmonic oscillator. This quaternionic
equation also yields the Klein-Gordon wave equation with a covariant
(space-time dependent) mass. This mass is quantized and is given by
$m_{*n}^2=m_\omega^2\left(n_r^2-1-\beta\,\left(n+1\right)\right)\,,$ where
$m_\omega=\frac{\hbar\omega}{c^2}\,,$ $\beta=\frac{2mc^2}{\hbar\,\omega}\, $,
$n$, is the oscillator index, and $n_r$ is the refractive index in which the
oscillator travels. The harmonic oscillator in 3+1 dimensions is found to have
a total energy of $E_{*n}=(n+1)\,\hbar\,\omega$, where $\omega$ is the
oscillator frequency. A Lorentz invariant solution for the oscillator is also
obtained. The time coordinate is found to contribute a term
$-\frac{1}{2}\,\hbar\,\omega$ to the total energy. The squared interval of a
massive oscillator (wave) depends on the medium in which it travels. Massless
oscillators have null light cone. The interval of a quantum oscillator is found
to be determined by the equation, $c^2t^2-r^2=\lambda^2_c(1-n_r^2)$, where
$\lambda_c$ is the Compton wavelength. The space-time inside a medium appears
to be curved for a massive wave (field) propagating in it.
