Is the sexual act contrary to achieving enlightenment? I remember reading in a sutta that the Buddha said not engaging in the sexual act is considered right action. Does anybody know the place where that is written? I don’t remember where I read it.
That was referenced in this answer.

The word used there is abrahmacariyā and associated with celibacy.

That word used that way (celibacy) in the 3rd of the eight precepts -- see the references at the start of this answer -- a different word is used in the 3rd of the five precepts.

I think it has a broader meaning than celibacy though, e.g. it's used in SN 54.2 -- so instead of or as well as "celibate" it's translated "the holy life" or "the spiritual life" -- I think it refers to a monk's life, including keeping the rules of the vinaya and the company of other monks.

Where it's used in SN 45.8, I note that the three types of wrong action which are listed there -- i.e. killing, stealing, and sexual intercourse -- correspond to parajika offenses which result in someone's automatically losing their status as a monk or nun.