A very realistic reason to do this, in a space combat situation, would be to reduce your electromagnetic flux profile.

No, that isn't Star Trek technobabble. Consider: every time you switch on a lightbulb, a certain amount of electromagnetic radiation is produced. Not all of this is visible light; there is a small but definite amount of RF energy produced. Most of the time our radio equipment is dealing with signals that overwhelm any such radiation, but if you're trying to hide from an enemy starship while sitting in deep space fifty lightyears from the nearest star, you want to produce as little energy as possible -- your enemy might detect the stray radiation, figure out which direction it came from, and use it to get a lock-on.

Of course, with the amount of visible light that a Star Trek-style starship reflects and produces, this wouldn't make any sort of difference. Didn't anyone tell them that the best way to hide a starship would be to paint it black? Make it radar-absorbent, too, while you're at it.

On reflection, just turning out the lights probably wouldn't make a whole lot of difference in the amount of radiation being produced by a starship; after all, starships tend to have fusion reactors, antimatter generators, nuclear warheads, and other such energy-producing devices aboard, which would make any benefit from turning out the lights effectively nil. But if, say, the Klingons have managed to baffle those radiations enough so that they can use a cloaking device, Federation starships might have similar capabilities, and it helps to lock down every bit of stray EM one can.