Rinse with cold water right away. That's it.

Salt and sand don’t need soap or special treatment. A thorough rinse in cold water gets rid of both without damaging the fabric or elastic.

Here’s the thing: swimsuit elastic hates heat and agitation. Hot water, washing machines, and dryers will wreck the spandex faster than any sand could. The sand will settle at the bottom of the sink or shower, and the salt dissolves into nothing. If sand is stubborn, let the suit soak for ten minutes in cold water, then rinse again.

Never wring or twist to squeeze out water. Press the suit between two towels instead. That keeps the shape and the elastic happy.

This is one of those cases where doing less is actually better for your gear.