They did! The current solar system is the stable aftermath of a fairly violent growth period, so what we see now is the result of a several-billion-years-long evolution.
Many of the objects in the universe didn’t begin their existence in the same form as they are seen now- large objects are usually built up from much smaller objects, instead of appearing rapidly at full size. This holds for both galaxies and planets. The planets in our solar system started out just as slight clumps of dust and gas inside a larger disk of more gas and dust. There’s no particular reason for a fixed number of these clumps to pop up, and we fully expect that there were lots of them.
With lots of little clumps, each one of them could start running into the surrounding gas & dust, and some of that dust might have stuck to each little clump. This means that we soon have a very crowded solar system of lots of growing pebbles, growing by running into more dust. Each of these little things might become a planet if they keep on collecting more material, but this method of collecting the stuff around them isn’t very efficient. The star is also interfering here, gradually blowing away all of the leftover gas that hasn’t gone into making the star or making our little planet candidates. But there’s a much faster way to grow - collisions.
If each of these things smashes into another one, they can double their size very rapidly; and our current understanding of the early solar system suggests this is precisely how these things grew to roughly planet sized objects. The planet candidates which grew the fastest the earliest could continue to grow to a very large size, since they could capture smaller objects gravitationally, eventually pulling them into a collision course. Incidentally, this gravitational capture is how we think Mars got its two moons - Phobos orbits so close to Mars that it will eventually either break apart or smash into the surface of Mars.
Our moon is also thought to be the remnants of one of these collisions between almost-full-planets. Known as the Giant Impact Hypothesis, the idea suggests that an object about the size of Mars smashed into the proto-Earth, and some of the material slung out from the Earth’s surface recombined into the Moon. This is still ancient history in terms of the lifetime of the Earth- the Earth began forming around 4.6 billion years ago (give or take a few tens of millions of years), the impact would have taken place about 20 million years later, when the proto-Earth was already pretty much formed.
There was also a period of time called the Late Heavy Bombardment in the solar system’s history, where all the solar system bodies, including the moon, got pelted with a fairly heavy stream of asteroids. This started around 4 billion years ago and continued for about 300 million years. We can still see the marks of this on the Moon - the dark mare on the moon date to the Late Heavy Bombardment.
We’re still getting hit with stuff flying around in our solar system - it just happens that the majority of it is pretty small (on a cosmic scale) to have survived this long without already having crashed into another object. These “small” objects are still sometimes big enough to be of concern to life- the death zone surrounding the impact just depends on how big that object is.
All of the large planets have settled into stable orbits that don’t interfere with each other, after getting through that first 20 million years of chaos, so it’s very unlikely that the large planets in our solar system will crash into each other until the dynamics of our solar system change.
Sign up for the mailing list for updates & news straight to your inbox!