Water has too much surface tension to make bubbles last...they contract on themselves and pop, and the water evaporates fast too. But soap (and the soapy substances in toothpaste, etc., which are called "surfactants") is made of long chains of carbon and hydrogen atoms. One end of these attracts to water, the other ends HATES water and wants to move itself out of it. At the surface of the soapy water, the soapy molecules squeeze in between the water molecules while trying to get out. This pushes the water molecules farther apart from each other, and therefore decreases surface tension so that bubbles can form. So a bubble is like a water sandwich....the water is in the middle, and the inside and outside surfaces of the bubble are the water-hating ends of the soap molecules trying to escape. AND, since the anti-water (called hydrophobic) end of the soapy molecules is sticking out of the surface instead of the water, evaporation is reduced, so the bubbles last much longer.
Source: