Similar to FvM, I suspect it's for protection, but to protect against low output voltage rather than high input voltage.
Imagine we have a circuit with unregulated input = 60V, regulated output = 40V. That should be OK because there's only 20V across the LM317.
However if there is a capacitor between output and ground, then there is a problem at switch-on. Without the zener, the voltage across the LM317 will initially be 60V, before the capacitor charges up.