This is a physical word that was used in an emotional context. Technically a carapace is:
A carapace is a dorsal (upper) section of the exoskeleton or shell in a number of animal groups, including arthropods such as crustaceans and arachnids, as well as vertebrates such as turtles and tortoises. In turtles and tortoises...
Basically, it’s a shell. I encountered the word in a marvelous book called The Emperor of All Maladies, which is a history of cancer. In it, the author describes a cancer patient descending into the hell of chemotherapy, and shutting herself off emotionally from the people around her:
Her melancholy hardened into something impenetrable, a carapace, and she pulled into it instinctually, shutting everything out.
“Pulled into it” is clearly a reference to the shell of a turtle, of which the word seems to most often refer (though, technically it refers to the shell of lots of different things).