If one is sitting in Nafl (voluntary) I?etikaaf, he may leave the Musjid specifically to attend a Janaaza or take a bath. If he is sitting in Sunnat I?etikaaf, for example, in the last ten days of Ramadhaan, he cannot leave the Musjid to specifically attend a Janaaza or take a bath.
He may do so subordinately, for example, when going to relieve himself, on the way, he may attend a Janaaza if the Janaaza is about to be performed or take a shower if the bathroom is empty.
and Allah Ta’ala Knows Best
Mufti Ebrahim Desai