Snail Plasma, a term used in "I Was a Teenage Gary," is a slime produced by snails used to move about. Sometimes, it is required to inject some into a sick snail, but if injected into a being other than a snail, then that being would turn into a snail.
Role in episode
Purple Doctorfish tells SpongeBob to inject his pet snail Gary the Snail with it to cure him. However, Squidward accidentally injects SpongeBob with it, changing SpongeBob's DNA and turning him into a snail. Later, Squidward accidentally injects himself, turning him into a snail, too.
Purple Doctorfish seems scared to do the injection to Gary himself, making it possible that he knew that injecting the snail plasma into a being other than a snail would turn them into a snail.
Snail plasma is the slime trail that a snail leaves behind it when it moves. In later episodes, SpongeGar and Patar have been seen eating it but don't turn into snails. It is unknown why they do not transform into snails. It is possible that for the snail plasma to work, it must be injected into people - not eaten.
SpongeBob as a snail is briefly seen slithering but doesn't leave a slime trail behind him. This could be due to the fact that he is a Sponge-Snail, so in this form, his sponge part could be absorbing the slime trail - or it could simply be an animation error.