While it might sound strange to some people, getting a boner while pooping is actually quite normal. According to experts, the erections that occur while on the toilet are caused by the stimulation of the pudendal nerve. This nerve is responsible for controlling sexual arousal and muscle contractions, so when it's stimulated by a bowel movement, it causes an involuntary response.
This is the main reason why many people experience a boner while on the toilet. However, there are other reasons why this might happen as well. One possibility is that men who have a lot of bowel movements tend to have a higher chance of experiencing a boner while on the toilet. This is especially true if they have their bowel movements first thing in the morning when they experience a phenomenon known as “morning wood.”
Another possible reason why guys get boners while pooping is that the pressure of pushing out a large or difficult stool can increase blood flow to the penis. This is because the rectum and the penis are located in very close proximity to each other, so when a significant amount of force is used to pass a stool, more blood will be sent to both the rectum and the penis, which can result in an erection.
In addition to the above reasons, some people might also experience a boner on the toilet because of certain medications they're taking. This can be a side effect of some erectile dysfunction drugs or antidepressants. If you're experiencing a recurrent erection while on the toilet, you should consult with your doctor to ensure that there isn't a medical cause for this issue.