It is common for animals to congregate and socialise for reasons such as mating or hunting. It has been discovered that land-based hermit crabs socialise, but with an ulterior motive.
When the crabs gather they arrange in the form of a conga line, smallest to largest. They each hold the crab in front of them until one is wrenched from its shell, in which case they move up the pecking order into a larger home.
Hermit crabs originally find shelter in the form of old snail shells. Some remodel the shells to allow more room to grow and house more eggs. These larger crabs left without a shell have to resort to ones that are often too small, leaving them vulnerable to larger predators.
Read more at University of California, Berkeley