Your friend seems to have type 1 diabetes mellitus
. Having incontinence
means he's suffering from mostly autonomic neuropathy or temporary loss of control due to very high or very low sugars. If it is so, and he's in extreme weak state with mental aberration, then he might be running with very high sugars or low sugars or frequent fluctuations in sugars. I do not know what was the evaluation of the doctor when you took him to the hospital, but please monitor his sugars and then take appropriate steps to control them first. Take help of a Diabetologist
and also a Neurologist
for the same. He/ she will certainly evaluate him for the possible complications he might be having and suggest further course of treatment. All the very best.