Lumbar punctures are also called spinal taps. When this procedure is performed, a small needle is inserted into the lumbar region in the back (small of the back). A small amount of cerebrospinal fluid is removed for examination. Lumbar punctures are done for other reasons as well, such as administering antibiotics or anesthesia.
Headaches (often severe) are a common side effect of a lumbar puncture. The reason for this is because occasionally, small amounts of fluid can leak out. People that lie flat for 3 hours after a lumbar puncture are less likely to get these headaches.
Although it has not been substantiated, headaches after a lumbar puncture are thought to arise due to leakage of cerebral spinal fluid at the puncture site. When the fluid leaks out it leads to a decrease in cerebral spinal fluid pressure and volume. One theory is that the leakage, which results in lower pressure and volume, activates adenosine receptors, which leads to vasodilation and headaches.
Some risk factors for these headaches are young age (18-32 years), being female, a history of these headaches following lumbar puncture, low body mass index, and type and size of the needle used for the procedure.
Funny you should ask this question, because it happened to me. I had had a spinal tap done to see if I had any bleeding on the brain, due to an unexplained and unprecedented migraine. There was none, but by puncturing the dura around the spinal cord, it caused a small leak in the spinal fluid. They gave me some medicine to stop the migraine and it never returned, but when I returned home, any time I would stand up, I would get a bad headache.
The leak in the spinal fluid accelerated with gravity causing the brain to depress slightly whenever I stood up, causing the headache. I had to have another procedure called a "blood patch" to seal the leak, and the headaches disappeared.