It has been believed for some time that stars can form from a collapsing nebula. But is it actually possible? Let's look at processes that would be happening if a cloud of gas tried to collapse into a star.
Firstly, as we've learned from a physics class; when gas is compressed, it heats up. This creates extra pressure. And the more you compress something, the harder it is to keep compressing it. A nebula would simply resist compression before a star can be formed.
Secondly, a collapsing cloud would spin faster as it collapses. Imagine a skater spinning slowly while holding weights in both of his outstretched arms and trying to pull in those weights. While spinning slowly, it wouldn't be too hard for the skater to pull in the weights. Suppose, he decided to pull in those weights, while spinning. Due to the concept of conservation of angular momentum, the momentum from the weights would need to go somewhere, as the distance decreases; so the skater would end up spinning faster. Similarly, as a spinning gas cloud pulls in its material, and the distance from the center to the edges of the cloud decreases, that momentum would have to go somewhere, and the cloud would spin faster and faster.
Another thing that skater would discover, is that the closer he pulls in those weights, the harder it would be to continue pulling them in. With gas clouds, it would be extremely hard. Even if, by some miracle, a star was able to form by pulling in the material of a cloud, it would be spinning extremely fast. We should be observing stars that spin very fast. The reality though, is that most stars spin slowly.
Thirdly, as a cloud collapses, its magnetic field would just resist any further compression. Try pushing two magnets together, with their like poles facing each other.
Haven't stars been actually observed to form from nebulae though? Not exactly. Nobody could observe a nebula collapse into a star from start to finish, simply because... the process would take several of our lifetimes to complete. Not even the time since modern scientists began recording data until today, would be enough for the process to complete. All we could see is that nebulae appear to be collapsing, and just because they appear to be collapsing now, doesn't mean they will complete the collapse and not rebound at some point.
So how did the stars form? They were created by God in the beginning. And many nebulae were probably created as nebulae.
Lisle, Jason. Taking Back Astronomy. Green Forest, AR: Master, 2006. Print.