If they are this type of worm under the surface of the skin they are not "contagious"...they spread by being transferred/transmitted from one animal to another by physical means. A mosquito or fly that is carrying these microfilariae or foleyella bites the chameleon and the worms end up in the blood of the chameleon and migrate to other parts of the chameleon's body.
If the load is heavy, treatment can result in death due to systemic reaction involving the release of endotoxins from the microfilariae dying in the bloodstream.
I don't know if they pass into the intestines and could be transmitted through the feces or not...but I would make sure that I used good hygiene and didn't move from cleaning one cage to cleaning the next or handling one critter and then handling the next without washing well in between.
Maybe someone else will know if they can be passed by oral/fecal means??
When you go to the vet, most likely he/she will take a blood sample to determine what species of parasites are actually in your cham. Madagascar chameleons have been known as one of the species that often attacked by this kind of parasites.
Like Kinyonga said, the culprit that spread this to your chameleon is most likely (not limited to) a mosquito that carries the microfilariae.
When not treated, your chameleon will exhibit symptoms of lethargy, anorexia, and weight loss.
I have heard that some species of parasites cannot be treated by oral medicine. The fear is the medicine will not only kill the worms but also your cham or like the one that kinyonga said.
So, the way they treat this is by making an incision on the skin and literally yank the worms out and suturing the incision.
This treatment will be repeated over and over until all the parasites are gone.
The worms will produce eggs. And your chameleon's feces will have lots of the worm's eggs in it, until some insects or other organism accidentally eat it.. or if your cham is bitten by a mosquito and the cycle continues.
the feces itself might not directly transfer the parasites to other chameleons.
But, my guess is the parasites can be transferred to you.
If you touch the eggs and then touch your mouth or etc..
Or if you forgot to clean your hands.. You know the rest of the story, right.
So, my Most important advice of all... exercise cleanliness when you handle this particular cham, his cage, the things inside the cage.
and don't forget to clean your hands as well.