The nuclear magnetic resonance (NMR) angular velocity sensor detects angular velocity by measuring the shift in the nuclear spin precession frequency, which is of fundamental interest. Recent studies have revealed the parameter dependency of nuclei frequency shifts induced by non-uniformly distributed polarized pump beams, temperature, and magnetic field properties. In this study, we investigated the effect of the linear transverse gradient magnetic field on the frequency ratio shift of the Xe isotope nuclear resonance frequency in the NMR sensors. A theoretical analysis method was proposed based on the Fermi contact interaction in atomic polarization and the spin-diffusion relaxation of 129Xe and 131Xe nuclei. The frequency ratio shift of the Xe isotope under different x-axis gradient magnetic fields was measured experimentally. Furthermore, we eliminated the equivalent residual magnetic field through a feedback system and compensated for the original gradient magnetic field in the system, which contributed to accurately revealing the frequency shift induced by the magnetic field gradient. The results indicate that the frequency ratio shift of the Xe isotope is proportional to the strength of the second-order linear transverse gradient magnetic field. This study provides a reference for the analysis and evaluation of the presence of the gradient magnetic field in the NMR angular velocity sensor.