We ask Allaah to heal you and grant you well being in this world and in the Hereafter.
If you can put on these socks before you sleep, when in a state of complete purity, this is good. It is well known that the non-traveller may wipe over the khufoof (leather slippers) and the like for one day and one night (24 hours) from the first time he wipes over the socks after breaking his wudoo’.
If you do wudoo’ and then put them on before you sleep, and you wipe over them at the time of Fajr, it is permissible for you to wipe over them until the time of the next Fajr.
This will solve the problem of putting on the socks when not in a state of purity.
If you cannot do that, such as if it will be harmful to wear them whilst sleeping, then there is nothing wrong with putting them on before getting out of bed, and that will come under the ruling on plaster casts, because you have no choice but to wear them and you will be harmed by not doing so., and it is not essential to have put the plaster cast on when in a state of purity in order to wipe over it. This is the view of the Hanafis and Maalikis. See al-Mawsoo’ah al-Fiqhiyyah (15/108).
Shaykh Ibn ‘Uthaymeen (may Allaah have mercy on him) said in Sharh al-Kaafi: Undoubtedly the correct view is that it is not essential that plaster casts be put on when in a state of purity, rather when there is a reason to do so, they may be put on and one may wipe over them. End quote.
But it must be noted that if we regard these socks as being like plaster casts, in that case one must wipe over the whole thing, top and bottom, down to the ankles, and it is not permissible to limit it to the upper surface only, as is the case with khufoof and socks.
And Allaah knows best.