Without help from a vet, your guy could actually die from prolapsed hemipene.
Jann's advice is spot on and I have actually used it on more than one occasion. However, a vet did tell me to use honey rather than sugar water.
The reason for using anything with sugar is for the osmotic affect- the hypertonic honey or sugar water draws the fluid out of the swollen hemipene, shrinking it back into place. The honey is thicker and will have a longer lasting affect simply because it sticks around, coating the surface rather than running off.
Also, I would recommend keeping the male in a tank or tub that has soaking wet paper towels on ground with nothing for the chameleon to climb on. That way the hemipene will be in contact with moisture and not dry out. Reapply the honey as needed.
BOTTOM LINE - get to a vet. It is possible to amputate one hemipene and the other hemipene (yes there are two) can still work, (produce babies.)