Virtually all animals, even crabs are able to feel pain. In fact, Not only do crabs feel pain, they are also able to retain memory of it. Both pain and stress are also key survival mechanisms for the crab. There have been experiments where hermit crabs have been electrically shocked and then provided with vacant shells afterwards. In which case they were all found to abandon their old shells and enter new ones, exhibiting stress related behaviors such as grooming of the abdomen or rapping of the abdomen against the empty shell.
Grooming for a crab can also be used as a protective motor reaction viewed as a sign of pain. Crabs are also equipped with a central nervous system and receptors that help them learn to avoid negative stimulus after experiencing such. Like humans if they are hurt they will limp or rub the appendages that are in pain. Studies have also shown physiological changes that occur within the crustacean including the release of adrenal like hormones that occur when pain or stress is suspected in the creature much similar to that of a human. Unfortunately for crustaceans such as the crab, they often become food for humans and sometimes are even boiled alive. In which case, they would feel pain! Perhaps this is something most of society should begin to consider.