
A meaning that difficult circumstances will bring together very different people.
The first writer to record anything close to this expression was Shakespeare, in The Tempest, 1611: My best way is to creep under his gaberdine; there is no other shelter hereabout. Misery acquaints a man with strange bedfellows.