When the Earth was young it was very hot. Volcanic activity released a lot of water vapour into the early atmosphere, and at first it stayed as a gas because the Earth was too hot for liquid water to last.
Condensation is the change of state from a gas to a liquid, and it happens when a gas cools. As the Earth cooled over a long time, the water vapour in the atmosphere condensed into liquid water.
The liquid water fell as rain and collected in the hollows on the Earth's surface. Over time these filled up and formed the oceans.