There could be a number of reasons for it if they have hairballs that will make them sick worms can do it as well the dog may have eaten or drank somthing that didn't agree with its system.
I think you see the vet. My dog had a problem with his stomach on an allergy bases. It made him look bad on the outside too. At first they throw up because they ate something bad. But later if he continues to throw up it means that he has a stomach problem or an allergy attack.