Maggots themselves are typically safe enough for your dog to eat, but the surrounding biological matter they were living in can be harmful, prompting your dog to vomit. In such cases, you should consult your veterinarian to rule out parasites or other problems from spoiled meat or garbage.