Drooling (foaming) isn't the only symptom of being exposed to rabies and hopefully your pet is just having a tooth or gum problem, but here's an overview of possibilities:
The Center for Disease Control (CDC) has a very helpful site with regard to guidelines concerning pets bitten or encountering a rabid wild animal, human exposure and vaccinations http://www.cdc.gov/ncidod/dvrd/rabies/ques&ans/q&a.htm
So many people think it's ok to delay this vaccination or to skip the booster shots, right up until their companion is unexpectedly exposed to rabies.
If your companion is determined to actually have become infected, they must be euthanized. There's no wiggle room here. It's the law.
Rabies is disease that's nearly 100% preventable when responsible pet owners have their companions vaccinated and these vaccinations maintained for the life of the pet.
Since there's no going back in time to get the pet the necessary vaccinations that would lend peace of mind for this moment, all anyone can do is the right thing from here on out.
In all possible situations, bring your pet and the animal they got involved with (if it's dead), to your vet right away. Your companion will likely be held under controlled observation (this is for your safety and the safety of everyone in your home, including other animals) for several days and if it's possible to test the offending animal (if you have a body, put it in a plastic bag, seal tightly and bring with you to the vet), that will probably be done. Many times this is done without a fee since animal control agencies need to document rabies outbreaks.
Chances are that your companion will be fine, perhaps having just contracted a bacteria or other infection/parasite that's much more easily treated than rabies; however, we often just get one ‘second chance'. Make sure your pet has all current vaccinations maintained all the time.
In a dog that doesn't usually drool a lot, when this starts to happen it can be a symptom of anything from stress to life threatening bloat. It could also be a gum or tooth problem, as well as the result of ingesting something not-so-good.
If you suspect bloat (Gastric Dilation-Torsion Complex) urgent care increases chances of survival. This link is not only necessary for owners, but suggested to print out and bring to the vet as well. http://personal.uncc.edu/jvanoate/k9/bloatfaq.htm
Excessive drooling might be a hepatic disease (liver disease) symptom, usually along with vomiting, diarrhea (grey-white feces), loss of appetite and so on.
Cardiomyopathy and heart failure may include excessive drooling as a symptom.
Take a look in the dog's mouth and check for any sores, abscesses, broken or damaged teeth. Are the gums normal color? Does the throat look sore, inflamed ?
Could the dog have ingested any poisonous substance, plant or even a toad? If you think this has occurred, rinse the mouth out as much as possible. If less than two hours have passed and if you are positive the dog did not ingest anything acidic, sharp or petroleum product , get 1 to 3 teaspoons of hydrogen peroxide into them every 10 minutes (up to three times). Also do not induce vomiting if the dog ate tranquilizers or if the dog is lethargic, sleepy or unresponsive. Call your vet, bring the product you think the dog ingested (if possible) and get emergency treatment.
It could also be just plain stress and excitement.
A vet visit is never the wrong the thing to do and it's very worth the peace of mind.