Good question.
The basic answer is that all you need is raw materials (silicates, some metals, in a big dust and gas cloud) plus gravity. Tiny bits clump together to form bigger bits, and so on, until eventually you have a few hundred miles of diameter and then gravity does the rest. Takes a while, of course, but that's the basic model.
There are several posts here with more detail. Here's one:
http://cs.astronomy.com/asycs/forums/p/38736/409967.aspx#409967
You can also Google terms like the following:
presolar nebula
nebula hypothesis
protosolar disc
planetary accretion disc
After a point, they're no longer "in space" in the sense that they're surrounded by vacuum or at most some gas and dust in a big cloud: the bigger bits have formed enough of a planetary body for true mineralogical processes to begin. Once a silicate body reaches a few hundred miles in diameter, there is enough mass that the heat and pressure you alluded to come into play. That's when you start to get more complex lithologies and true "rocks" ...
Why are there so many? Because the accretionary nebula was huge ... it was several times as large and the current mass of the inner Solar System. Ferocious solar winds from the Sun's formative years blew most of it away from the inner Solar System, much of it going into interstellar space. In the intervening eons, collisions have caused many of the larger bodies to break up into smaller ones. Gravitational encounters with Jupiter have tossed many of these into the outer reaches of the Solar System.
While the process may have peaked more than 2 billion years ago, it still goes on. And on Earth, plate tectonics recycles crustal rock every few hundred million years. The Solar System is a dynamic place -- even for rocks.