This question already has an answer here:
Even though moon and satellite orbit the planets in multiple planes why our solar system is co-planar? Not only that, ring systems of several planets are also co-planar. Is it the way they evolved with the time? Or is it the only possible way a planetary system can be formed?