A:
Most likely this is a vaso-vagal reaction. Heres what I mean. Often people need to tense their abdominal muscles and strain a bit during a bowel movement. This tends to stimulate the vagus nerve. A stimulated vagus nerve slows the heart rate.
At the same time, when you tense your abdominal muscles, blood flow back to the heart decreases a bit. This results in a lower blood pressure.
The combination of a slower heart rate and lower blood pressure could make you feel lightheaded and weak.
I would expect the symptoms to resolve over a few minutes once you lie down. But the fact that it takes you several hours to feel normal makes me concerned that there may be something else contributing to these weak spells.
I suggest you make an appointment with your doctor. Theres still a good chance that your doctor wont find anything else. The reason for weak spells often cannot be diagnosed. But your doctor will want to consider underlying problems, such as anemia (low red blood cell count) or heart disease.