Here's an excerpt from Wikipedia on coral spawning:
"Synchronous spawning is very typical on the coral reef, and often, even when multiple species are present, all corals spawn on the same night. This synchrony is essential so male and female gametes can meet. Corals rely on environmental cues, varying from species to species, to determine the proper time to release gametes into the water. The cues involve temperature change, lunar cycle, day length, and possibly chemical signalling. Synchronous spawning may form hybrids and is perhaps involved in coral speciation. The immediate cue is most often sunset, which cues the release. The spawning event can be visually dramatic, clouding the usually clear water with gametes."
Wikipedia points out about 25% of hermatypic (hard) corals are single sex corals and release gametes separately while the rest are hermaphrodites. You can see the release of sperms from a colony and releases of sperm/egg packets in this wonderful Fabien Cousteau's video taken in the Flower Garden Banks National Marine Sanctuary, in the Gulf of Mexico:
[video=youtube;CleWRmrpkJE]http://www.youtube.com/watch?feature=player_embedded&v=CleWRmrpkJE[/video]