In short, whenever there is anything that couples to the spin. If you the spin really is isolated, then it may well be conserved independently, but this will generally not be the case. Unfortunately, that's about as much as you can say about the general case.
For the specific case of the spin of the Earth, then indeed it is approximately conserved over short timescales, but over periods of several thousand years it does change.
In this specific case, as with all spin-affecting gravitational interactions, the culprit is tidal forces, and these exert a torque whenever the body deviates from spherical symmetry. The Earth, for example, bulges at the equator, which is not aligned with the orbital plane; moreover, the bulge on the Sun-facing side is more strongly attracted to the Sun than the bulge on the night side, which means that there is a residual torque that tries to align the spin and orbital angular momenta. And, since there is a torque acting on it, the spin is no longer conserved independently.