In this paper, we determine a constant occurring in a local analogue of the Siegel-Weil formula, and describe the behavior of the formal degrees under the local theta correspondence for a quaternionic dual pair of almost equal rank over a non-Archimedean local field of characteristic
0
0
. As an application, we prove the formal degree conjecture of Hiraga, Ichino and Ikeda for the non-split inner forms of
S
p
4
\mathrm {Sp}_4
and
G
S
p
4
\mathrm {GSp}_4
.