One of the elements of yogic practice is brahmacharya. Brahmacharya means sexual continence. Sexual continence involves avoiding sexual activity that is not done without the intent to have children.
And so things like masturbation and casual sex are not allowed in brahmacharya but sex done in the hopes of developing a pregnancy is allowed in brahmacharya.
Hindu scriptures state that the sexual orgasm weakens the body and the mind and this belief is why brahmacharya is considered an element in yoga. Yogic practice involves many things. Some people simply meditate and they are considered to be involved in yogic practice. Some people to hatha yoga which is the stretches and exercises. Some people do more than one type of yoga.
Here is a webpage that goes into detail on brahmacharya.
http://www.sivanandadlshq.org/download/brahmacharya.htm