the polyps extend to feed and take in light. during the night time, they conserve energy, so they draw polyps in and such "sleeping" behaviors.
Some corals extend feeders during the night after extending light gathering polyps during the day. An example of this would be a trumpet or candy cane coral. Polyps fat and plump during the day, lights out -> feeder tentacles extend and gather food from the water column. Most every coral has daytime/nighttime behaviors.