Heartgard, the most frequently used heartworm med in the US, is just ivermectin. The half-life is only 24-36 hours so it leaves the body quickly (in feces). The doses used for heartworm prevention are quite low, and there is very minimal risk except for some sheepdogs because of a mutated gene. Click here for more info. The drug is used in much higher doses for other parasitic infections.
I know the heartworm injection was recalled here, so we stick with the pill.