The 1990 novel, Expedition, by Wayne Barlowe said that the planet Darwin IV used to have oceans which dried up. This resulted in the bacteria forming a thick layer to trap the remaining water under. What could cause the oceans to disappear like that? How could the bacteria evolve like this?
Sink or swim (AKA "We'll all hang together or else we'll all hang separately")
I gave a design suggestion set for the sea in your question about walkers. For evolution, it really just requires pressures to make a bunch of organisms (or a few good ones) to be very symbiotic. Work together or die.
In a world of dwindling resources, everything wants the water. The logical step is for a cactus-like organism to try and hog all the water. It would start with a sea of plants (providing food) secreting a slime layer to encapsulate the water, eventually ensliming ALL the water as resources got scarce. Animals would want this water and food, and perhaps an amoeboid colonial organism started engulfing this stuff to feed, but came to treat the plants much like organelles for food. Other animals would want to feed on the plants, but the aggressively defensive amoeboids would keep the plants alive. Communal amoeboids would secrete an increasingly tough layer on the outside to fend off predators. It would either come to behave like a giant single organism, or else like an amoeboid version of an ant colony (with parts working for the whole benefit.
The oceans disappeared on mars
what happened was the planet cooled to the point water started freezing out at the poles and not melting meaning it slowly drew all the moisture out of the atmosphere which is replaced by the evaporation, which gets frozen out, so and so forth.