What he said ^^^ is accurate. Here's what the vacuum disconnect on the front axle looks like, looking from behind the front passenger tire.
Here's a vacuum diagram that should help you trouble shoot the system.
I would start by pulling the two vacuum lines from the front axle, usually black, that feed the disconnect from the transfer case switch. With the vehicle running, have a friend shift the transfer case from 2wd to 4wd, while you feel for vacuum in the two lines. Strong vacuum should switch between the two lines depending on 2wd and 4wd.
You should also remove the 4 bolts holding the disconnect to the front axle. Remove the disconnect from the axle housing and move the shift fork by hand. It should move back and forth easily, forcing air out of the vacuum ports when moved. Rusty water may also come out the vacuum ports.
Like mentioned, corroded or broken vacuum lines are a common problem, especially under the battery. Make sure the vacuum source from the intake manifold to the transfer case switch (usually red vacuum line) is intact.
The switch on the transfer case could also be bad. They're available at most auto parts stores under the 'Help' brand of accessories.
For an easy fix to get 4wd engaged, remove the disconnect from the front axle housing. Slide the shift collar toward the driver's side to engage both axle shafts. Install the disconnect upside down and the fork will hold the shift collar in the locked position. You will now have 4wd. You can run this way on the road but the front axle will be spinning the front driveshaft while in 2wd (the front axle does not drive the front driveshaft if the axle is disconnected and in 2wd).
Post up your findings, and if you have any more questions.