There was a time when the Genesis of Planets took place. This was the period wherein some of the debris was not able to become part of the planet. According to some studies, the rings that are present in Saturn and Uranus also come from the old moons that these planets used to have.
There were some moons that became too close to the planets and they have exploded. Instead of going into nothingness, the moons started to orbit around the planets. They have become the rings of Saturn and Uranus. The rings are made of different types of components. Some components are made of ice, dust, and other debris.