'Nocturnal encopresis' is the psychiatric term for the involuntary passing of feces during sleep for no known physiological reason. Same term with 'enuresis' applies to bedwetting.

Your friend is actually falling asleep on the toilet, not passing out? Passing out while defecating is actually quite common, but sleeping...I can't say I've ever heard of that. Is your friend on sleep meds?