:sl:
Ghusl is required due to the emission of maniy (semen) from its exit in the male or female, which happens either when one is awake or when one is asleep. If it is emitted when one is awake, there is the condition that one feels pleasure when it is emitted.
If it is emitted without pleasure, then ghusl is not required, such as if it is emitted as the result of sickness. If it is emitted when one is asleep, this is what is called ihtilaam (erotic dream) and ghusl is required in all cases because he was not aware (of whether there were feelings of pleasure or not) and he may not experience feelings of pleasure.
If a sleeper wakes up and finds traces of maniy, then he must do ghusl. If he has an erotic dream but no maniy comes out of him, and he does not find any trace of it, then he does not have to do ghusl.
http://www.islamqa.com/en/ref/93027
:w: