Ligaments stretch slowly under a steady load. After a long spell of slumped sitting the ligaments of the low back have lengthened, and the reflex that makes the deep muscles protect the joints is weaker for hours.
Sitting also holds most spinal joints in one small part of their range, day after day, and stress keeps resting muscle tone raised.
Motion is lost a little at a time, with no injury to mark the start. This is a reasonable explanation for the adult who wakes with a locked neck after doing nothing unusual. The problem was years in the making.
Measured in animal and human experiments: sustained bending stretches the spinal ligaments and weakens the protective muscle reflex for hours.