I keep a few of the larger ones where I have sand. I like to watch them pop up out of the sand. I don't think they are necessary but just a few don't disrupt very much and are fun to watch. They also scavenge some bits of food here and there.
To be clear invertebrates( shrimp, mollusks, corals, crabs ,etc) can not osmoregulate. They can not control their internal specific like a fish can or you or I can by drinking or urinating or otherwise gaining or expelling fluids.
Invetebrates have some chemical internal processes which let them manage internal sg . how much of this they can do varies by organism but ovrall they can't manage much. They are generally subject to an internal sg very close to that of the water around them. If it's too high fluid diffuses out and they dehydrate. If it's too low fluid diffuses into them and they over hydrate. Either condition will kill organisms by disrupting homeostsis( chemical balances in the body) ;it's worse if the change in external salinity is sudden; hence careful acclimation helps. But it's still bad to keep them in sg other than one natural to them or close to it even if a long acclimation period is used.
Fish have an internal specific gravity of about 1.008. Fresh water fish would bloat with fluids except they urinate a lot and drink very little . Marine fish are the opposite and their kidneys have evolved to process highly concentrated urine and they drink copious amounts of water. Brackish fish are somewhere in the middle.Personally, I think it's good practice to keep fish in sgclose to their natural environs which for natural seaswater on average is about 1.026.
So all of the fish keep their internal sg at 1.008 but their internal orgnas andprocesses vary based on the environs they have evovled to thrive in.
If internal sg goes off kilter in fish inverts, humans etc homeostasis is lost ,ie, all the internal chemistry goes out of balance , internal organs malfunction and the organism dies.