Usually another sleep disorder, but also drug and alcohol use
Sexual behavior while asleep, particularly after person-to-person contact
Sexsomnia is a condition in which a person will engage in sexual activities while still asleep. This condition falls within the broad classes of sleep disorders known as parasomnia.
Sleep sex at Wikipedia