That's because of a chemical reaction in their abdomen. They have it when they are trying to attract mates. The glow is produced by oxygen mixed with luciferin and an enzyme called luciferase. See http://animals.about.com/od/insects/f/fireflies.htm for more information.
One reason that fireflies glow is to attract a mate. Males and females of the same species will flash signals back and forth as a way of communicating. Each firefly species has its own particular pattern. For example, the fireflies of one species will fly around in the night sky and dive steeply just as the flash begins and turn upward to make a distinctive J-shaped pattern of light. Female fireflies hang out on a tree branch or in the grass while the males fly around showing off their best flashes. When a female recognizes the flash from a male of the same species, she will answer with her best flash. Another reason that fireflies glow is to avoid predators. Fireflies are filled with a nasty tasting chemical called lucibufagins, and after a predator gets a mouthful, it quickly learns to associate the firefly's glow with this bad taste. So not only does the flashing help attract a mate, but it also warns predators to stay away.
Shining, clouds clung to the blue flame of the day. Two roses under the window opened - Two bowls full of fire. In the window in the cool darkness of the house, Looked sultry green garden, hay and sultry languor of jets sweet flavor. Sometimes, resonant and heavy, high in the sky Thunder rumbled hum ... But the singing bee flies rang - the day shone. Sometimes noisy streams running through showers of blue ... But the sun and the blue of blinking in the mirror-shifting their brilliance - And the day shone, and melted rose, languid heads of clones, and smile through the tears in the eyes, full of fire.
Fireflies use a chemical reaction to shine. The males signal to lady fireflies on the ground that he is ready to mate and if she flashes a message that she is ready, he will fly down to her. Some females say no and on he flies. The girls decide.