More than likely that there's nothing more seriously wrong than the transfer case shifter mechanism external to the transfer case has simply slipped out of adjustment. There is a single bolt with a 1/2" head on it that the mechanism depends on to hold everything in adjustment and if/when it slips, it can become impossible to get the transfer case to stay in gear or go into the desired gear.
Here's a photo of that bolt circled in red, the mechanism is of course underneath the Jeep. Loosen that bolt, pull the shift rod back in a tad to where you may be able to see a mark in the rod from that bolt where it used to be positioned. Get underneath the Jeep to watch the mechanism while a helper pulls it into 4Hi so you can see how it works and understand the issue.