Soaps are fatty acid salts. They are comprised of two distinct portions: a carboxylate head (those of you who remember your organic chemistry will recognize that as a CO2 group) and a long hydrocarbon tail (a tail that is simply carbons and hydrogens).
|Sodium stearate is an example of a soap.|
Soap molecules have both of these traits put together. Near the carboxylate head, a soap molecule is polar. However, by the time you find yourself wandering down to the other end of the molecule, it's acting pretty hydrocarbon-y, meaning it will act non-polar. The head of a soap molecule is hydrophilic (water-loving). The tail is hydrophobic (water-fearing). As a result, soap can mix with both polar and non-polar solvents.
In a polar solvent, such as water, the soap molecules will form a sphere called a micelle, with the carboxylate groups surrounding the hydrocarbons on the inside. The outside, hydrophilic layer makes the whole shebang water soluble. (In a non-polar solvent, the reverse will occur.)
This general mechanism also forms the basis of other specialized soaps, such as shampoo.