Your circuit would almost work. The main issue is that there is no current limiting resistor for the zenner. People typically use PMOS and switch the positive side, but negative can also be used.
Down is your schematic with some improvements. First, there is R1 which is 10k and limits the current to the zenner (very important). Second, for additional improvement I added diode D2 which will clamp negative voltage in case something goes wrong or if there will be short glitches due to mosfet capacitance or an event when input voltage switches polarity very quickly. Small capacitor C1 is also for glitches / ringing. Last, I added bidirectional TVS diode on the input, to protect against voltage transients exceeding maximum mosfet voltage. If you want to use this on 24V, you should maybe look at slightly higher voltage mosfet then IRF3708 and choose TVS accordingly.