Without all the emergency questions, it is hard to say what might be wrong. But if the shell is still there, then it is unlikely that he was attacked for his shell (although he could have been, and they just didn't take the shell completely away). It is possible that he was attacked by another crab and injured, and now is too weak to stay in the shell. It is possible that this is just as far as he could make it, for whatever reason, and he has weakened and now is just going to die. However, as he will definitely die without a shell, although I hate to even suggest this, most likely his best chance will indeed be for you to dig him up and iso him in good conditions with possible shells and hope you can get him to re-shell. The problem of course is that you might injure him while digging; the cave could collapse, etc. If he has not been shell-less for very long, you might give him just a little while longer to possibly re-enter the shell that is there. If he doesn't, you'll have to either try to recover him and iso him, or decide that perhaps he knows it is "his time" and let him go.
The fact that he has been down for weeks without apparently molting again might indicate that he got injured after he came up from the molt, and so felt like he needed to molt again right away, but maybe just couldn't manage (too injured?). Or maybe the fact that there was too much light there right next to the glass caused problems with the molt?
I might try putting black construction paper over the "window" and giving him just a little longer to see if he can re-shell; peek only when it is dark in the room. Again, though, if he does not re-shell pretty quickly you'll have to decide whether to dig or just let things take their course.
I hope some others will come along with other opinions, too; I have not faced a shell-less crab underground, this is a whole new situation to me, so I just don't have direct experience there. I really wish you the best and hope all works out as well as it can.