First let's learn a little about hermit crab development. When they hatch, they are free swimming zoea. They go through a number of zoeal instars, meaning they'll molt and grow, but will still have basically the same form and function.
little larval Anapagurus laevis
After a certain number of instars, the zoea will molt into a megalopae stage. Megalopae will swim around until they find a suitable substrate to settle. Once they settle, they can then molt and grow into a juvenile hermit crab, when they'll finally look like mini-versions of the hermit crabs we know and love!
almost there, little buddy!
So when does the protective gastropod shell come into play? You may have guessed it already: during the megalopae stage! As they settle, the little guys are looking not only for good habitat structure and food availability, but also for shells or shell fragments. If no shells are available to protect their minuscule bodies, hermit crab megalopae can delay morphing into the juvenile stage. But they don't want to dilly-dally, since shell-less hermit crabs at either stage suffer higher mortality rates than those with shells.
Now, what do I mean by "little"? Check out this guy:
the large claw on this Pagurus bernhardus is about 1 mm long
For comparison, pick up a nickel. A nickel is almost 2 mm thick, so this hermit crab megalopa is probably around the same size as your nickel is thick! That's how tiny hermit crabs are when they start looking for shells, or more likely at these sizes, shell fragments to protect their soft abdomens!
Where's the science?
Roberts, M. H. Jr. 1971. Larval development of Pagurus longicarpus Say reared in the laboratory. IV. Aspects of the Ecology of the megalopa. Biological Bulletin 141: 162 - 166.
Oba, T., and S. Goshima. 2004. Temporal and spatial settlement patterns of sympatric hermit crabs and the influence of shell resource availability. Marine Biology 144: 871 - 879.
Harms, J. 1992. Larval development and delayed metamorphosis in the hermit crab Clibanarius erythropus (Latreille) (Crustacea, Diogenidae). Journal of Experimental Marine Biology and Ecology 156: 151 - 160.