If the foam is still wet, don't try to wash it off with water since it will just make it cure faster.  Start by wiping as much of the foam off your skin as possible with a rag or paper towel. Then, apply acetone or nail polish remover that contains acetone to the area to dissolve the remaining residue. Alternatively, you can also spray a small amount of carburetor cleaner or WD-40 on the affected area and rub the skin together until the foam is removed. This cuts the stickiness and makes it far easier to get off your skin.
This videos shows the carburetor cleaner in action so you can see how well it works:
Unfortunately, once the foam is dry, there is very little you can do to get it off your skin. It is pretty much immune to solvents, so you are stuck waiting for it to wear off. Touch n' Foam, one brand of spray foam, recommends using a pumice stone to gently scrape away the dried foam from your skin. They also advise applying petroleum jelly to the affected area and covering it with a plastic glove for about an hour. When the time is up, wash the area with soap and water. If necessary, you can repeat this process.