There is a common misconception that sex was always considered bad in the Middle Ages, but this was certainly not the case. Connected to this is the common assumption that medieval thinkers thought the body was bad and the spirit good, but this is equally mistaken.
Sex was certainly considered wrong outside of marriage. But then, modern social norms say pretty much the same thing. Everyone agreed then, as they do now, that adultery, having sex with one person while married to another, was Wrong. After all, it's forbidden in the Ten Commandments.
Fornication (as opposed to adultery), that is sex among the unmarried, was frowned on more severely then than it is now, especially for upper-class women, who really were supposed to be virgins before marriage. But no one got too concerned about unmarried upper-class men, as long as they were discreet. And everyone recognized that sex could be the product of falling in love.
(The image above is an old medieval church in Dijon, not used as a church anymore, instead used as a theatre. They were putting on a play with Adult Content.)
The purpose of sex was procreation, so sex within marriage was fine, as long as one did not indulge in it for pleasure alone. Even in Eden before the fall, theologians argued, Adam and Eve would have had to have sex in order to be fruitful and multiply, as they were supposed to do. Couples were supposed to refrain on Sundays and important holy days, however, in order to focus instead on spiritual thoughts.
If one thought that the body and sex were altogether evil, one was a heretic. After all, it was very clear in Genesis that God had created the physical world. It was fallen, but it could still be redeemed. The will, not the body, was considered the chief source of sin. And, all medieval thinkers agreed, when one rose again at the Last Judgment, one would rise in one's physical body--improved certainly, but still physical and still one's own.
As I discussed earlier, marriage required physical consummation. Even a royal wedding was supposed to be completed with sex. A great many couples living together today, who have promised to stay together indefinitely and have consummated their union, would be surprised to learn that, by medieval standards, they are in fact married. Because their promises/oaths were not given before witnesses, they have done it wrong (and should probably do penance), but their marriage is still valid. Peasant couples in the Middle Ages would similarly make their oaths before a few witnesses and move in together. Sooner or later a priest would come by and bless their union.
There were certainly misogynists in the Middle Ages who would say that it was all women's fault if men had inappropriate lusty thoughts--as there are today, as one will learn listening to talk radio. But most medieval thinkers blamed the one who had the lusty thoughts, not she who inspired them.
By the way, gay sex was not considered particularly worse than heterosexual fornication. Monasteries worried about it, but that was because, when the male monks did not see women for months or years at a time, it was the only kind of sex worth worrying about.