I didn't want to take over inferno's thread by posting this question on his so I decided to start my own. What causes a prolapse and is there anything you can do to prevent this from happening?
The male hemipenes may be pushed out during defecation, or in conjunction with depositing some seminal material - and the hemipenes should revert back (be pulled back in by the muscles) into their normal position within a few moments.
A prolapse where it stays out can be due to constipation or impaction, and I believe certain parasite infestations.
Mitigate chances of this situation by keeping chameleon well hydrated, dont feed too many hard-to-digest prey items, avoid substrate.
Further to Sandra's reply, it happens with females more commonly during egg laying due to the amount of stress this causes. It is severe in itself however with the females sometimes the ovaduct can be pushed out as well. I had a snake do this after laying and everything had come out...she was in bad shape, but after a vet trip, a stitch to keep things in she is fine but can never be bred again as the chances of it happening again are very high in her case.