They appeared on Earth quite early, already in the Cambrian, although it is currently debated whether organisms from this period should be classified as snails.

An excerpt from the article 19 facts about snails

These organisms had rudimentary and primitive shells. Over the next 80 million years, they slowly evolved to flourish and develop many different forms in the Ordovician. The first snails inhabited the seas and oceans. Individuals anatomically similar to those currently living arose in the Triassic, and it was only in the Cretaceous, 150 million years ago, that they began to colonize land.