It means to twist one's hands together in fustration, distress or despair. In this expression, the frustration/distress/despair element is the most important part of the meaning. The reference to hand motions is often as much figurative as literal.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.