While Albani declared the hadith as Sahih, there are some who actually think it is daeef, as for instance quoted by Ibn Amin:
و هذا الحديث ضعيف. أخرجه الطبراني (20|211) من طريق شداد بن سعيد (فيه ضعف)
Link in arabic
Having that said, lets look at the meaning of the hadith.
There are different of opinions of what the word touch is meant to mean in this hadith. Many say it means touch, in its literal sense, while other say it means touch, as in intercourse (zina). I will try to show the evidences used to prove it to mean intercourse in this hadith and context.
The hadith in Arabic:
رواه الطبراني والبيهقي عن معقل بن يسار عن رسول الله صلى الله عليه وسلم قال:
" لأن يطعن في رأس أحدكم بمخيط من حديد خير له من أن يمس امرأة لا تحل له "
The problem occurs when we translate the hadith. There are two possibilites of how we could translate the word يمس in this context:
Even the first translation "touch" could be argued to mean "sexual harassment" or "intercourse", even in English. For instance, imagine looking at a court, a man is accused of rape. To his defense, he says to the prosecutor: "I swear I didn't touch her!".
Proof in Arabic that it might mean intercourse
Now someone might say, where did you get the word "intercourse" from and who said it is one translation of the word "مس"? The answer lies in the Holy Quran, in many different verses:
قَالَتْ أَنَّىٰ يَكُونُ لِي غُلَامٌ وَلَمْ يَمْسَسْنِي بَشَرٌ وَلَمْ أَكُ بَغِيًّا
She said, "How can I have a boy while no man has touched me and I have not been unchaste?"
Surat Maryam, verse 20
يَا أَيُّهَا الَّذِينَ آمَنُوا إِذَا نَكَحْتُمُ الْمُؤْمِنَاتِ ثُمَّ طَلَّقْتُمُوهُنَّ مِن قَبْلِ أَن تَمَسُّوهُنَّ فَمَا لَكُمْ عَلَيْهِنَّ مِنْ عِدَّةٍ تَعْتَدُّونَهَا ۖ فَمَتِّعُوهُنَّ وَسَرِّحُوهُنَّ سَرَاحًا جَمِيلًا
O You who have believed, when you marry believing women and then divorce them before you have touched them, then there is not for you any waiting period to count concerning them. So provide for them and give them a gracious release.
Surat Al-Ahzab, verse 49
You will find the same words in 2:236 "لَمْ تَمَسُّوهُنَّ", and "2:237" قَبْلِ أَن تَمَسُّوهُنَّ".
In all these verses, in the given contexts, it is clear, that the literal word "touch" means intercourse.
Check Ibn Kathir (قبل الدخول بها), Tabari (قبل أن تـجامعوهنّ) and so on.
Choosing between touch and intercourse in the hadith
We now know that there are two possibilities to interpret the word "يمس" in that hadith. So which word will it be? The conclusion of the hadith will differ incredibly according to which of the words we will use when interpreting the hadith.
Let us look at the hadith. We will insert each possible word, then analyze the hadith and see which makes most sense:
For one of you to be stabbed in the head with an iron needle is better for him than that he should touch a woman who is not permissible for him.
For one of you to be stabbed in the head with an iron needle is better for him than that he should have intercourse with a woman who is not permissible for him.
In my view, the second translation is the right translation. Clearly it is an attempt to show with a parable, the seriousness of having illegal sexual activities (intercourse) and that it is worse than getting stabbed in the head with an iron needle. This sounds much more logical than just touching a womens hand (with no sexual intention at all).
Now, we also have this hadith from Sahih Al Bukhari:
Anas bin Malik said, "Any of the female slaves of Medina could take hold of the hand of Allah's Messenger (ﷺ) and take him wherever she wished."
and in this it mentioned that the prophet didn't let go off the hand of the (slave) woman until she let go herself:
“If a female slave among the people of Al-Madinah were to take the hand of the Messenger of Allah (ﷺ), he would not take his hand away from hers until she had taken him wherever she wanted in Al-Madinah so that her needs may be met.”
Some might say that she was a slave or an old woman therefore the rule doesn't apply on her. Where is that mentioned in the hadith? The only reason they explain away this is to not contradict their explanation of the hadith.
There are many more ahadith one could use here to support what I am aruging about.
By everything given above, my conclusion (and even scholars hold this conclusion of course) is that the hadith is clearly speaking about intercourse, and not just touch in its most literal sense. If it was speaking to touch as in hold hands, shake hands, the Prophet would not let the slave woman hold his hand, due to the serious warning in the hadith. Therefore the hadith is speaking about intercourse, which the other verses in the Quran shows about the word in many places.
While this is my conclusion, one should not forget that most scholars follows the other opinion saying it literally means "touch".
علي جمعة - حكم مصافحة المراة - Ali Gomaa
Also relevant: لماذا تُحَرّمون مصافحة النساء؟
Ibn Amin - Mosafaha (رسالة في المصافحة بين الرجل و المرأة)