  We assess the effect of magnification bias on the $E_G$ statistic for probing
gravity. $E_G$, a statistic constructed from power spectrum estimates of both
weak lensing and redshift space distortions (RSD), directly tests general
relativity (GR) while in principle being independent of clustering bias. This
property has motivated its recent use in multiple tests of GR. Recent work has
suggested that the magnification bias of galaxies due to foreground matter
perturbations breaks the bias-independence of the $E_G$ statistic. The
magnitude of this effect is very sensitive to the clustering and magnification
biases of the galaxy sample. We show that for realistic values of the
clustering and magnification biases, the effect for magnification bias is small
relative to statistical errors for most spectroscopic galaxy surveys but large
for photometric galaxy surveys. For the cases with significant magnification
bias, we propose a method to calibrate magnification bias using measurements of
the lensing auto-power spectrum. We test this calibration method using
simulations, finding that our calibration method can calibrate $E_G$ from 2-4
times the simulation error to well within the errors, although its accuracy is
sensitive to the precision of the measured redshift distribution and
magnification bias, but not the clustering bias. This work gives strong
evidence that this method will work increasingly well in future CMB lensing
surveys.
