When people talk of 'sex' you need to be clear if its the physical part, or the mental part.
Diabetes can induce various states of depression or increased in stress from time to time from person to person, and in these states you may feel that you have no, or little sex drive - which doesn't mean you CAN'T have sex, it just means you don't think of it, and don't really want to - lacking motivation.
Whereas other physical problems can cause the inability to physically engage in sex whether you wanted to or not (erectile dysfunction).
I would think that at a younger age, lack of sex drive would be most common because that person could be fairly depressed and just mentally un well at the time, which can go away with a bit of work mentally. For this it may be best to see a psychiatrist, or someone you can talk to.. maybe take a vacation and get a change of perspective on life.
Physical ED would most likely be caused by a physical problem, likely from prolonged high blood sugars, which again i would think can be reversed after getting everything under control. For this i would certainly see a doctor first.
Anything can happen to anyone, at any age if you let it.