What gives the crab its characteristic gait?
The reason crabs walk sideways is simply a question of anatomy. Unlike humans, a crab’s legs are attached to the side of their body, and whereas our knees bend forwards allowing us to walk forwards, a crab’s joints bend outwards.
It is thought that crabs’ bodies evolved this way because having their legs on their side gives them longer, flatter bodies, which makes it easier for them to hide in the sand. Crabs also scavenge for food, and because of this they do not need to run fast to chase their prey or hunt for food — the reason other animals have evolved with forward-facing, speedy legs.
There are, however, some species of crab that can walk forwards, including the soldier crab, or Mictyris platycheles. It’s able to do so because its joints allow for anterior-posterior leg movement.