Stars (and subsequently planets) form when big,
rotating clouds of gas and dust slowly contract.
This is the presolar nebula.
Freedman and Kaufmann
The timescale for these stages is not well known,
but probably is something like 10 million years
from the beginning of cloud collapse to the
time when there is a full-fledged star (or protostar)
surrounded by an evolving protoplanetary disk.