The role of orgasm includes more than just procreation and partner bonding. Orgasm is also a powerful reinforcement of the behaviors and stimuli that elicit the response.
Classical conditioning theory can help explain this process. You’ve probably heard of Pavlov’s dog experiment, but just in case you haven’t: Pavlov rang a bell before feeding the dogs in this experiment. The food elicited a salivation response from the dogs, but after multiple trials, the ringing bell would cause the dogs to salivate. Therefore, the ringing bell became associated with food.
A similar process occurs with sexual stimuli and orgasm. Let’s take porn for example: "John" enjoys pornography that includes group sex, so he seeks out this type of stimulus when he masturbates. Every time he orgasms to stimuli (visual or fantasy) of group sex, "John"’s brain forms an association between the stimuli and orgasm. And the more he pairs his orgasm to group sex, the stronger the association. Now, this doesn’t mean that simply seeing or thinking about group sex will cause "John" to orgasm, but it will start the arousal process. And more importantly, "John" might find that it takes longer to become aroused or to achieve orgasm to other types of sexual stimuli. He may even have to fantasize about group sex when he’s being intimate with his partner in order to orgasm.
Understanding this process and the conditioning power of orgasm is crucial to cultivating healthy sexual behaviors. It is important to remain mindful of the stimuli one associates with orgasm and how frequently one orgasms to stimuli that aren’t accessible through sexual relationships. The use of pornography is not necessarily unhealthy, but fantasizing during sex with a partner certainly can be. (Vagueness is used here because healthy sexual behavior has an idiosyncratic definition. What’s healthy for one may be self-destructive to another.) In "John"’s case, including fantasy of his sexual partner and other types of pornography to his masturbatory practice is encouraged. In some cases, stimulus switching is necessary for re-conditioning orgasm. The person is instructed to switch from the problematic stimulus to a healthier one right before orgasm. Over time, the person switches to the healthier stimulus earlier in the arousal process and eventually can become aroused by the healthier stimulus.