The glitch activity of young pulsars arises from the exchange of angular momentum between the crust and the interior of the star. Recently, it was inferred that the moment of inertia of the crust of a neutron star is not sufficient to explain the observed glitches. Such estimates are presumed in Einstein's general relativity in describing the hydrostatic equilibrium of neutron stars. The crust of the neutron star has a spacetime curvature of 14 orders of magnitude larger than that probed in solar system tests. This makes gravity the weakest constrained physics input in the crust-related processes. We calculate the ratio of the crustal to the total moment of inertia of neutron stars in the scalar-tensor theory of gravity and the nonperturbative f(R) = R + aR(2) gravity. We find for the former that the crust-to-core ratio of the moment of inertia does not change significantly from what is inferred in general relativity. For the latter, we find that the ratio increases significantly from what is inferred in general relativity in the case of high mass objects. Our results suggest that the glitch activity of pulsars may be used to probe gravity models, although the gravity models explored in this work are not appropriate candidates.