Soap acts as an emulsifying agent. An emulsifier is capable of dispersing one liquid into another immiscible liquid. Nearly all compounds fall into one of two categories: hydrophilic and hydrophobic. Water and anything that will mix with water are hydrophilic. Oil and anything that will mix with oil are hydrophobic. When water and oil are mixed they separate, which is why hydrophilic and hydrophobic compounds just do not mix. When grease or oil is mixed with a soap- water solution, the soap molecules work as a bridge between polar water molecules and non-polar oil molecules. It doesn't separate them -- in fact, it does the opposite. Soap allows water and oil to mix.
See the Related Questions to the left for more information about how soap works.