The environment of any planet is far from fixed. Gradually, over time, a planet’s surface and atmosphere will evolve and change. A major way this happens is that light gasses can be slowly lost into space. As explained by a paper published in Proceedings of the Royal Society A, this includes water vapor. A process called atmospheric escape slowly shapes a planet’s climate, as light gasses slowly drift away into space. A planet can slowly lose water this way, gradually drying out.
An article from Scientific American talks about this in detail, mentioning how, in a planet’s upper atmosphere, it’s all about escape velocity. Just like a rocket traveling to orbit, if a molecule is moving fast enough with nothing in its way, it’ll simply escape from a planet’s atmosphere. This is even more likely if a molecule gets split into its much lighter component atoms.
Atmospheric escape can happen on any planet with an atmosphere, though it’s easier with lighter gasses. As Popular Science notes, Earth’s gravity isn’t strong enough to hold onto helium, among the lightest gasses to exist, so any helium in Earth’s atmosphere will inevitably be lost to space. A paper published in Annual Reviews of Earth and Planetary Sciences explains how astronomers have observed atmospheric escape happening in exoplanets too. Notably, it’s a significant process in smaller planets, like Earth or Mars, with a major effect on how a planet evolves over time.