caregiver222 is right, passing out during deep or prolonged coughing could be due to exaggrated vagal response (vasovagal syncope)
A syncopal episode after a cough is common. It is called a vasovagal syncopal episode. The vagus nerve, when stimulated, drops the heart rate. The heart rate drop a lot. The vagal nerve meanders through the body. One of the places it wanders near is affected by a cough. This causes a biological messenger to be sent to the atrial pacemaker site reducing the heartrate. lowers the amount of blood pumped to the brain momentarily and causes light-headness or sometimes unconsciousness. That's what's going on. This is not necessarily a cause for undue concern. Many people have extremely sensitive vagal nerves. The late Jackie Kennedy had this condition. It can cause a problem while driving. As a mater of trivia (Hey, you might getnon cash cab) the vagus nerve is also close to the anus. When you strain on the toilet you drop the heart-rate. This is why many cardiac patients are found dead on the toilet.