There are two theories as to how planets in the solar system were created. The first and most widely accepted, core accretion, works well with the formation of the terrestrial planets but has problems with giant planets such as Uranus. The second, the disk instability method, may account for the creation of giant planets.
The core accretion model
Approximately 4.6 billion years ago, the solar system was a cloud of dust and gas known as a solar nebula. Gravity collapsed the material in on itself as it began to spin, forming the sun in the center of the nebula.
With the rise of the sun, the remaining material began to clump together. Small particles drew together, bound by the force of gravity, into larger particles. The solar wind swept away lighter elements, such as hydrogen and helium, from the closer regions, leaving only heavy, rocky materials to create terrestrial worlds. But farther away, the solar winds had less impact on lighter elements, allowing them to coalesce into gas giants such as Uranus. In this way, asteroids, comets, planets, and moons were created.
Unlike most gas giants, Uranus has a core that is rocky rather than gaseous. The core likely formed first, and then gathered up the hydrogen, helium, and methane that make up the planet's atmosphere. Heat from the core drives Uranus' temperature and weather, overpowering the heat coming from the distant sun, which is almost two billion miles away.
The disk instability model
But the need for a rapid formation for the giant gas planets is one of the problems of core accretion. According to models, the process takes several million years, longer than the light gases were available in the early solar system. At the same time, the core accretion model faces a migration issue, as the baby planets are likely to spiral into the sun in a short amount of time.
According to a relatively new theory, disk instability, clumps of dust and gas are bound together early in the life of the solar system. Over time, these clumps slowly compact into a giant planet. These planets can form faster than their core accretion rivals, sometimes in as little as a thousand years, allowing them to trap the rapidly-vanishing lighter gases. They also quickly reach an orbit-stabilizing mass that keeps them from death-marching into the sun.
As scientists continue to study planets inside of the solar system, as well as around other stars, they will better understand how Uranus and its siblings formed.
A dangerous youth
The early solar system was a time of violent collisions, and Uranus was not exempt. While the surface of the moon and Mercury both show evidence of bombardment by smaller rocks and asteroids, Uranus apparently suffered a significant collision with an Earth-size protoplanet. As a result, Uranus is tipped on its side, with one pole pointing toward the sun for half the year.
Uranus is the smallest of the gas giants, perhaps in part because it lost some of its mass during the impact.
— Nola Taylor Redd, SPACE.com Contributor