Answer
In the Name of Allah, Most Gracious, Most Merciful.
All praise and thanks are due to Allah, and peace and blessings be upon His Messenger.
In this fatwa:
If someone takes off his socks then puts them on again when he is not in a state of purity, it is not permissible for him to wipe over them; rather it is essential for him to wash the feet when doing wudu. The fact that he only took the socks off for a few seconds does not change the ruling, because in fact he put on the socks when he was not in a state of purity, so it is not permissible for him to wipe over them.
Answering your question, the Fatwa Center at Islam Q and A, states:
It is not valid to wipe over the socks when doing wudu except in the case of one who put them on in a state of purity. This is indicated by the authentic Sunnah of the Prophet (peace be upon him).
Al-Bukhari and Muslim narrated that Al-Mughirah ibn Shubah said: I was with the Prophet (peace be upon him) on a journey, and I bent down to take off his leather socks, but he said: “Leave them, for I put them on when my feet were clean,” and he wiped over them.
According to a version narrated by Abu Dawud: “Leave the leather socks, for I put them on my feet when they were clean.”
An-Nawawi said:
“This indicates that wiping over the leather socks is not permissible unless one put them on in a state of complete purity.”
Ibn Qudamah said in Al-Mughni (1:174):
“We do not know of any difference of scholarly opinion regarding the stipulation that prior purification is required in order for it to be permissible to wipe (over the socks).”
Imam Malik (may Allah have mercy on him) said:
“Wiping over the leather socks is only permissible for one who put them when they were clean, after doing wudu. As for the one who put them on his feet when they were not clean and he had not done wudu, he cannot wipe over the leather socks.” (Al-Muwatta (1:37).
It says in Al-Muntaqa Sharh al-Muwatta (1:78):
“It is as he said: if a person put on his leather socks after doing wudu, then he broke his wudu, then took off the leather socks, then put them on again, the ruling on wearing them when in a state of purity is no longer applicable, and he is now wearing them when not in a state of purity. Putting on the leather socks when in a state of purity is a condition of it being valid to wipe over the leather socks.”
Based on that, if someone takes off his socks then puts them on again when he is not in a state of purity, it is not permissible for him to wipe over them; rather it is essential for him to wash the feet when doing wudu. The fact that he only took the socks off for a few seconds does not change the ruling, because in fact he put on the socks when he was not in a state of purity, so it is not permissible for him to wipe over them.
Almighty Allah knows best.
Source: www.islamqa.info