Your teenage son wrecks the car. Your daughter shows up with her recently paroled boyfriend.
These are the sorts of things that can make your hair turn gray overnight.
Actually, it's impossible for hair to completely change color overnight. Hair color comes from a pigment called melanin. When hair grows, the cells that form the growing hair accumulate melanin and distribute it throughout the shaft at the center of a strand of hair. The hair's color depends on the number, size, and color of the melanin particles.
Gray hair results when, for some reason, the production of melanin is reduced, or stops completely. When this happens, the hair becomes transparent and all we see are the colorless cells that make up the hair shaft. Although it is common for melanin production to decrease and eventually stop as a person grows older, there is no specific explanation as to why this happens. Heredity seems to play a significant role in determining when the cells that make hair stop making pigment. If you have inherited genes programmed to shut off the production of melanin at an early age, you'll go gray sooner than later.
The phenomenon of suddenly going gray due to stress has more to do with hair loss than with actually losing color. A significant amount of stress can cause hair to fall out prematurely. If you already have a significant amount of gray hair, the remaining dark hairs might be in a non-growing, resting phase, and thus are more likely to fall out. The sudden loss of dark hair will make it seem as though you've gone gray overnight.