Sodium lauryl sulfate (SLS) is a surfactant, which basically means it has an effect on the surfaces it touches. It's used in a variety of products such as food thickeners, toothpaste, and floor cleaners.
Regarding its use in cosmetics and body products, the safety assessment study of SLS, published in 1983 in the International Journal of Toxicology (the most recent assessment), found that it's not harmful if used briefly and rinsed from the skin, as with shampoos and soaps.
Sodium lauryl sulfate is a surfactant, which means a molecule that has ampiphilic properties. This means the sulfate head group (shown by the pink shading in the diagram below) is hydrophilic and water soluble, while the 12-carbon-long chain is hydrophobic and water insoluble.