White foam usually occurs when a dog is vomiting on an empty stomach. It could be due to stomach irritation or an obstruction, or could it be due to kennel cough. If happens more than 1-2 times in a 24-hour period, or if happens regularly, call your vet.