I am not able to marry due to the mental illnesses I have and I won't be able to marry for the foreseeable future. Is it permissible to masturbate to control one's sexual urges? As I will not have any means to fulfill my sexual desires with anyone for a long time because of my mental illnesses.

No, but you can get into temporary marriage with a divorced or a widow lady.