Welcome to the forum. Thanks for your question.
The only way that rectal inflammation can be related to STD is by direct inocuation of the anus or rectum. With the exception of genital warts and other HPV lesions, which can be transmitted by hands or by spread along the skin from the genital area, there would have had to be sexual activity involving your rectum. Such infections -- like gonorrhea, chlamydia, or rectal herpes -- are only seen in people who have had recetive anal sex, i.e. penile-anal contact, i.e. women of men having sex with men.
So assuming your sexual history is accurate, you can be sure no STD explains your rectal inflammation. That said, such inflammation isn't common merely after passing impacted stool. If the problem persists or you have other questions about it, you should return to the doctor treating you to be sure there isn't a potentially important underlying problem like ulcerative proctitis/colitis, Crohn's disease of the rectum, etc. But don't worry about STDs.
I hope this has helped. Best wishes-- HHH, MD
Many thanks. I will go back to see him in 10-14 days per his instructions.