Oceans may have formed on other planets when their atmospheres changed drastically. When a planet's atmosphere is primarily composed of carbon dioxide, its surface temperature cannot rise very high due to the greenhouse effect, and water molecules don't have sufficient energy to escape the atmosphere. However, if the atmosphere undergoes a substantial change, such as an increase in oxygen or nitrogen, it may allow for the formation of liquid water on the planet's surface, leading to the creation of oceans.