There are a few things to consider. First, if your dog just had a large snack of another dog’s poop then he simply could have over eaten and needed to empty out his stomach. The second major cause of vomiting feces is to vomit so hard that not only the stomach gets emptied but also the small intestines.
If it’s a case of your dog having too large of a snack, then the question is why does he eat poop? Some dogs do it because their stomach doesn’t feel good, some dogs do it because they are hungry, and some dogs do it because they learned the behavior at a young age. It’s mostly gross and often hard to keep dogs from poop eating behavior once it begins.
If it’s the second case, your dog might be quite sick. He could have an intestinal obstruction, or food poisoning, just to name two causes. Regardless, take away all food and water. If after 12 hours there’s no vomiting you can slowly give small amounts of water to drink. If there’s no vomiting by 24 hours you can reintroduce food. If the vomiting returns at any point – this is an emergency and I recommend going to your veterinarian immediately.
Even if your dog overindulged on a snack of yardsicles, I still recommend taking away food and water for a period of time. If he ate enough to cause himself to vomit then his intestines are sensitive and upset. If the intestines are upset, then dogs do best by having a small break from eating. A break of four hours from water and skip one meal (no treats) will help calm the tummy – as long as nothing more serious is going on.
As mentioned above, if the vomiting returns, it’s reason to go to your veterinarian as soon as possible.
Hopefully, your dog sticks to grass and more benign outdoor eating explorations.