Neohelix albolabris removed from its shell. The red arrow points at the part of the snail's body that fits into the spire of the shell and the blue arrow points at the penis (cut open) with the attached vas deferens. The folded flap of skin visible above the penis normally protects the penis and the other organs located within the foot when the latter is outside the shell.
If a snail is removed from its shell, one can see that the upper whorls of the body (red arrow in the photo), which normally never leave the shell, are unsupported and the organs incorporated in them will be visible behind only a thin membrane. In contrast, the organs within the foot (for example, the lower genitalia, including the penis) are protected by a thick skin.
From this observation, we can conclude that in gastropods with shells large enough to cover at least most of the body, the external shell has evolved to support and protect some of the organs.
Nevertheless, this conclusion, if stated in the following form, could sound like a circular argument: The shell protects the exposed organs and the organs are exposed, because they are protected by the shell. There is no circularity, however, when one realizes that gastropod anatomy and shell have evolved together. If, for example, the ancestral gastropods had lost their shells during their early evolution, this would have taken place concurrently with the movement of their organs to locations within their body cavities.
It follows from these considerations that a snail lineage can’t undergo a drastic reduction in shell size without accompanying changes in its anatomy. This is exactly what has happened during the evolution of slugs from snails: as the shell got smaller and smaller, the organs have migrated further into the body cavity.