All perfect praise be to Allah, The Lord of the Worlds. I testify that there is none worthy of worship except Allah, and that Muhammad is His slave and Messenger.
First of all, we recommend that you look for a way to bring your wife to live with you.
The length of time that you, as a husband, are away from your wife may have an impact on your case. If you consult some specialists doctors, they may provide you with some guidelines or some useful drugs.
‘Usamah ibn Shareek narrated that the Prophet said: "O slaves of Allah! Seek treatment. Indeed, Allah has not sent down a disease except that He has sent down a cure for it, except death." [Ahmad and Ibn Maajah]
This act that you have asked about may be a means leading to masturbation, which is forbidden. In principle, it must be avoided, but if you need it, as you mentioned, for treatment and not for the purpose of pleasure and lust, then it is acceptable to resort to it, in our view.
Allah knows best.