OK, seriously? I am making this up but it’s based on my understanding of evolution. The shell is a great defensive mechanism because it makes a snail very hard to eat. It therefore allows snails to survive and reproduce. There are lots in my front garden which is why, on wet, dark nights I often feel them crunching underfoot as I return home. In the daytime I do try to avoid them!
The question that my answer now raises is: how did shells evolve? And I confess I don’t have the answer to that one. Not yet anyhow.
It’s easy to fall into traps with this kind of “why” question. The snail has a shell because its ancestors survived better and produce more baby snails than snails with thinner or smaller shells. There could be alot of reasons why the shell helped the snails ancestors survive. Land snails could retreat into the shell to prevent themselves drying out. Sea snails (which came first I think) could avoid being eaten by predators who couldn’t get through the shell, perhaps. The shell didn’t evolve to achieve a purpose, it just happened to keep the snail alive. Slugs are snails which have evolved to lose their shells, so in some circumstances it may be better not to have a shell. Slugs and snails sometimes live in very similar habitats (e.g., my garden), so there must be a fairly tight balance between the benefits of a shell (protection from predators and drying out) and the costs (e.g., carrying around all that additional weight, which must use a lot of energy).