Buy higher spandex content and a tighter fit.

It’s usually a fit or fabric problem. Cheap suits with low spandex (less than 10-15%) sag when wet because the nylon has no memory. Also, most people buy suits that feel comfortable dry, but once wet, fabric stretches 5-10%. You actually want it snug dry so it fits right wet.

Care helps too — rinse immediately after swimming (chlorine and saltwater wreck elastic), never put it in the dryer, and avoid sitting on rough pool edges. But the real fix is buying a suit with at least 15% spandex and trying it on wet before you buy (or ordering from a brand that allows returns).

A suit that fits dry but sags wet was never the right suit.