Fireflies 'glow' in larval and adult stages but for very different reasons. It is thought that glowing behaviour first evolved in larvae to deter predators(Branham and Wenzel (2003)). This is an example of an aposematic warning, which uses bright colours, smells, sounds, or in this case light, to tell predators they are undesirable as prey. Sometimes a prey animal will use an aposematic warning to tell predators they are poisonous, or simply to mimic a prey that is poisonous. In the case of firefly larvae, they don't taste good to predators because of a steroid compound in their bodies (Branham (2005)).
Adults also glow, but do so in a synchronized pattern of flashes to communicate with mates (Carlson and Copeland (1985)). Mates will time their flashing with physiological fluctuations and even respond directly to another individual's flashing pattern with appropriate delays and timing of responses.
So to answer your first question, fireflies are not continuously glowing, but flash at night as larvae to deter predators, and during active mating as adults.
Your second question can get into a long-winded explanation of how certain traits evolve in response to a pressure, but to simplify, it's likely that fireflies evolved glowing because it relieved predation pressure. This ability then evolved further to communicate the quality of mates more efficiently than phermone signalling.