In this glorious hadith, Muhammad says that touching a non-mahram (i.e., a marriageable) woman is worse than being stabbed in the head with an iron needle.
And in the hadith is a severe warning to one who touches a woman who is not permissible for him. And in it is proof of the prohibition on shaking hands with women, because this no doubt is included in touching.
(Al-Silsilah al-Sahihah 1/448)
Muhammad explicitly says “I do not shake hands with women.” (Nasa’i 4186). He never touches a woman’s hand, except for his slaves of course:
“….And the hand of Allah's Messenger ﷺ did not touch any woman's hand except the hand of that woman his right hand possessed (i.e. his captives or his lady slaves).” (Bukhari 7214)
I find Bukhari 7214 particularly rich, in that Muhammad has no problem enslaving women, but his high moral character won’t allow him to shake a woman’s hand.
Unfortunately, Islamic law is based on the presumption that Muslim men cannot be expected to exert basic self-control.
And that is why every Islamic school of jurisprudence, with no exception, forbids men and women from shaking hands. (Hanbali and Hanafi schools allow it for the elderly.) (Kuwaiti Encyclopedia of Fiqh 37/359-360)