I feel your pain with getting stuck in embarassing spots.
With regards to 4wd not engaging, unless you've installed manual hubs the hubs on your Pathfinder are automatic. This means that the wheels need to rotate in order to lock on to the front differential when engaging the 4wd. Pulling the lever in the cab only engages the 4wd transmission and the front differential. If the tires can't rotate the automatic hubs can't engage with the differential and therefore none of the engine power will get to the front wheels.
I think I've described this right but I may have used some of the wrong terms. I'm certain someone will be along shortly to correct me.
In short, switch into 4wd before you get stuck.