The vacuum switch on the brake& clutch pedal(s) disengages the 4wd when braking (or changing gear) so if you lock a (rear) wheel the system doesn’t try to engage 4wd and push power to the locked wheel thus overloading and straining the drive train,
the one on the clutch pedal also disengages 4wd when the clutch is depressed, if you have ABS then you dont have the vacuum switch on the brake pedal (its not needed as theoretically you cant lock the wheels) drive in reverse is sorted out by the gearbox (electrical) switch