His ghusl for ihram is sufficient to include his ghusl from janaabah, because it is a ghusl that is prescribed, especially in the case of someone who forgot. This was stated by the fuqaha' when they said: If he intends to do a Sunnah ghusl, it counts for the obligatory ghusl too. Some of them limited it to the case of forgetfulness. As both opinions are applicable in the case of the man mentioned, it is acceptable in his case. End quote.
Reproduced from Islam QA