When you were in a 2wd and shifted to 4wd, you had the steering wheel turned to make a tight circle? With slow speed, you were able to engage the chain in the tcase, rotate the front ds as well as the r&p and shafts to the tires. Thus you put the system into a bind since the tires rotate on a different arc within the circle, each tire will rotate a different distance. Then by putting tcase back into 2wd while in the circle, the system is still in a bind so it will stay engage.
When you put the tcase into 4wd, you are engaging a collar to transfer the rotation of the main shaft to the chain. Then the teeth engage. When you shift out of 4wd into 2wd, you have to release that engagement through rotation of the main shaft but without torque. Thus coasting. You can shift in/out of 4wd hi when the tires are spinning the same rotational speed as everything tied from the tires back into the tcase are spinning the same rotational speed. Once you start to drive it, you put the system into the bind engaging all the components to drive each other. Let off the gas and coast to let the components 'gap' and then you will be fine.