How unfortunate. I hope at least the low expansion type of foam was used to prevent buckling of the door frame. Once the foam is cured, it can only be removed mechanically, that is, by cutting, scraping or sanding.
If it simply bubbled out of the crack between your door jamb and frame while curing, just cut it flush with the jamb and your door surround trim will pretty up the crack.
If however the foam got elsewhere due to mishandling of the dispenser, it must be sliced or scraped off. If you're lucky in that it was partially cured by the time it got on the wall, you may be able to just pull it off.
Next time have some acetone handy when working with polyurethane foam; it dissolves it but only before it cures.