Secondary transitions from terrestrial to marine life provide remarkable examples of evolutionary change. Although the maintenance of osmotic balance poses a major challenge to secondarily marine vertebrates, its potential role during evolutionary transitions has not been assessed. In the current study, we investigate the role of oceanic salinity as a proximate physiological challenge for snakes during the phylogenetic transition from the land to the sea. Large-scale biogeographical analyses using the four extant lineages of marine snakes suggest that salinity constrains their current distribution, especially in groups thought to resemble early transitional forms between the land and the sea. Analyses at the species-level suggest that a more efficient salt-secreting gland allows a species to exploit more saline, and hence larger, oceanic areas. Salinity also emerged as the strongest predictor of sea snake richness. Snake species richness was negatively correlated with mean annual salinity, but positively correlated with monthly variation in salinity. We infer that all four independent transitions from terrestrial to marine life in snakes may have occurred in the Indonesian Basin, where salinity is low and seasonally variable. More generally, osmoregulatory challenges may have influenced the evolutionary history and ecological traits of other secondarily marine vertebrates (turtles, birds and mammals) and may affect the impact of climate change on marine vertebrates.