Yup, classic example of the faulty vacuum system! There are several "remedies" you could trouble shoot and fix what you have, install a posi-lock or cable like it, or do what I did and take the bolt out of the disconnect cover on the axle and slide the shift fork over and put a longer bolt in. That will hold the fork so the axle is connected and your four wheel drive will always work.
1991 Jeep Wrangler 2.5L, 5 speed
2003 SVT Cobra Supercharged 32V 4.6L, 6 speed