Collapsing interstellar clouds
Stars and planets form from clouds of gas and dust called interstellar clouds, which exist in space between the stars. The interstellar clouds consist of mostly of gas. Many interstellar clouds can be observed along the Milky Way in regions that have relatively high concentrations of interstellar gas and dust. An interstellar cloud can start to condense as a result of gravity and become concentrated enough to form a star and possibly planets. Astronomers hypothesize that our solar system began this way.
Picture from: http://www.rsc.org/chemistryworld/News/2007/July/05070702.asp
Picture from: http://www.rsc.org/chemistryworld/News/2007/July/05070702.asp