Why do Muslims sometimes not shake women's hands?
It's not about not shaking women's hands, but those of differing genders, which typically means men don't shake women's hands and women don't shake men's hands outside the family or spouse, other than in care of small children or the elderly. This applies to both fellow Muslims as well as non-Muslims, alike, but we have no expectation others would take this way. Allah says, "There is no compulsion in religion" (al-Qur'an 2:256) and "say. . . 'for you, your way, and for me, my way'" (al-Qur'an 109). And, so, Muslims should not have an expectation others would take their way.
Nonetheless, avoiding some handshakes is one of the hardest things in Islam to practice. I know I have no wish to offend, and I so appreciate when others take it well as a religious or cultural difference that does not prevent overall cooperation and respect, but facilitate it. In promotion of that sort of forbearance and multi-culturalism, I offer some explanation:
The super quick explanation of the wisdom of limiting handshakes is that Islam does the following:
It prioritizes exclusivity in marriage as a value.
It prevents even coming near to something that would critically weaken a value.
Handshaking rules are simple in the case of cisgenders, so let me start with that. The aim is that a person grows up not having had physical contact with non-family members of the opposite gender. And that’s during young adult and adult life until old age. As well, who you marry, you may have mutual physical contact with them in any way, with only little exception. Thus, marriage is a unique and spectacular situation where two people who marry have such a high degree of exclusivity that trust comes powerfully and naturally and the value of the spouse is all the more special. I mean, that’s the ideal, and the Prophet Muhammad ﷺ lived this way, without touching a woman forbidden to him.
Nonetheless, there are caveats:
Lots of folks are not cisgender and no one has a definite sign on them indicating either their biological sex or their sexual orientation, so there are lots of nuances to address. In practice in my own life, however, very seldom, if ever, have I found any issue here, despite working at a gender-diverse public university.
Limiting handshakes is not a foolproof guarantee of a successful marriage. A union can be complicated and there are so many factors that influence the outcome.
But, this practice can be very meaningful to a marriage and play a tremendous, positive role.