Taken from 'A Code of Ethics for Muslim Men and Women'
200 – Rule: Bodily contact that happens in busy places (such as markets, processions, Salat al-Jumu‘ah, funerals, the Sanctuaries (haram) of the A’immah (Peace be upon all of them), and the House of Allah سُبْحَانَهُ وَ تَعَالَى in an unintentional way between a non-Mahram man and woman is not a problem, with the condition that one does not go to these places with the purpose and intention of being touched. ABGKMST
It is clear from the ruling above, provided that a person is not deliberately putting themselves in a situation where they can be mistakenly touched in order to gain pleasure from it then they are blameless.
Allah knows our true intent and will surely judge us according to them. So if it is unintentional it is not a sin.