Our's did that. It died a few days afterwords. It may live and make another shell out of the sandbed. If you don't have sand, put it in a little 'Critter Container' with some sand in it. No need to put the lid on, I say, just weigh it down.
Also, for all those people who want to know what it looks like, the worm is brown with little spines on its sides.