So this has happened to me before and I don't really remember if it was ok or not but I just noticed foam coming up through the airlock during fermentation. I know it is still fermenting but I just wanted to make sure that was ok that it is doing that. I just started fermentation this past Saturday 8/20. 3 days later I noticed this.
If it's still coming up/out, you should switch to a blowoff hose. If it has stopped, you can clean, sanitize, and replace the airlock.
VikeMan is right with his advice, but for future batches you really should try to anticipate this need from your recipe's expected original gravity and attach a blow-off tube from the start of fermentation. Sometimes an airlock's center stem can get clogged from the foam and then the build-up of CO2 pressure will blow the airlock and/or cork from a carboy or the lid from a bucket and provide a new paint color to your ceiling along with a mess on the floor and surroundings. It's generally an OG in the 1.060 range and higher that you should attach a blow-off tube, especially in you have minimal head space in your fermentor. If you've never used a blow-off tube before you can do a search of this forum using that word, or google it, or I've read that YouTube has videos on the topic.
I just recently started using fermcap to keep the boil from over flowing, but it also seems to be keeping the krausen down as well. At least on the last two batches using 1318 which I always needed a blow off for before fermcap.