Anal sex does not directly cause long-term problems with constipation, as the consistency of the stool is determined long before it gets to the anus. It is possible to have anal problems that develop from anal sex, such as anal tears or local infection. If one of these problems causes anal pain or other symptoms, then there can be a subconscious reaction to avoid having a bowel movement, and holding the stool in as long as possible can lead to constipation. If this were to happen, there would be pain or other symptoms that would be contributing to the development of the constipation. In this situation, time will heal some of the problems (such as tears), but specific treatment may be necessary for others (such as antibiotics for infection). However, since you have never had any pain or other symptoms, this would be unlikely.
There are many other possible causes of constipation, and it is possible that it is simply a coincidence that it developed after this episode of anal sex. The most common cause of constipation is changes in the diet and a relative lack of fiber in the diet. It also can occur from a wide variety of conditions that can cause fluid loss or dehydration, as the colon will try to reabsorb as much water from the stool as possible, causing harder stools. It also is possible to develop constipation from disorders that affect the muscular activity of he gut, either a condition within the gut, such as irritable bowel syndrome, or systemic
conditions, such as diabetes or thyroid
disease. It is also common for constipation to occur as a side effect to certain medicines.
From the perspective of whether there is an anal problem from the anal sex that is causing the constipation, the first step would be a proper examination by a doctor that is aware that the anal sex occurred, so that it is known to examine for these possible conditions, and possibly obtain a culture. A complete history and physical examination and screening lab work will usually identify if there are any other avenues to pursue. Also, if the blood testing did not include thyroid testing, then it would be appropriate to do so. It is unusual to need to examine the inside of the colon for the evaluation of constipation in a young adult, but it may be necessary in severe or persistent cases. Usually, the approach taken by your Gastroenterologist to provide symptomatic relief, along with increasing dietary fiber and liquid intake and regular exercise, will lead to improvement.