Like many cnidarians, corals are capable of both sexual and asexual reproduction. In asexual, a colony spreads rapidly to take advantage of a good location or abundant food. Sexual reproduction allows for genes to be passed on, and allows for natural mutation to further the evolution of a species.
Sexual reproduction involves some extra steps, and therefore extra energy, so many marine animals do not utilize it unless conditions are absolutely ideal. Some really are THAT sensitive to lighting, and adding moonlights could trigger a spawn because these events often happen on a full moon. Try cycling through the moonlights and see if you can reproduce the results!
But as a general rule, they're just for show, so we can see in at night without bugging the fishies. LOL