How and why did the oceans form on Earth but not on other planets?
Your assumption that there is not a lot of water elsewhere in the solar system is incorrect.  According the this article on NASA's website;

Missions in recent years have overturned our view of a dry solar system, returning mounting evidence of ample water from a vast array of locations.
Comets from the remote corners of our solar system are made of water and other ices. Orbiters, landers, and rovers reveal Mars as a watery world in the distant past -- a world that today may contain entire underground oceans of frozen water.

It also points out that

Jupiter's moon Europa has a frozen crust of water, covering a thick global ocean. By current estimates, it has twice as much water as all of Earth's oceans and rivers!

The perception that the rest of the solar system does not have a lot of water is probably due to the fact that the Earth is in the 'Goldilocks zone' where water can exist in all three phases at the surface of the planet.  The temperatures on the rest of the planets in the solar system are either so hot that it can only exist in a vapor phase or so cold that it can only exist in ice at the surface or liquid beneath.