Hi there!
You are experiencing vasovagal syncope. Pooping strain triggers the vasovagal nerve and is causing that fainting low-blood pressure blackout feeling.
To get that feeling to go away, lay on the ground on your back and elevate your legs on the toilet so the blood rushes back into your brain. Will gradually stop feeling like you are dying. Ask someone to bring you cold water and a cold wet compress for your wrists and forehead and back of neck. Take B-12.
Once you can function again go see a doctor to confirm this new info. I have the vasovagal reactions every once in a while and this is what I do. Good luck!