I've also heard it phrased as "It's an ill wind that blows no good."
It's a very, very old saying--and today it is a little old-fashioned, although it is still used.
It means the same thing as another saying, "Every cloud has a silver lining."
Richard has explained it perfectly, so I'll just add some examples.
"It's an ill wind that blows no good. Higher political risks mean rising spirits for defence firms."--The Economist, 2015
"Henry wanted a grammar... and his mother could not furnish him with the money to buy it. On waking in the morning, he found that a deep snow had fallen.... 'Ah,' said he, 'it is an ill wind that blows nobody good.' He rose, ran to the house of a neighbor, and offered his service to clear a path around his premises..."--McGuffey's Fourth Eclectic Reader (1879)
"It's an ill wind... soggy summer produces Britain's world record marrow."--London Daily Mail, 2008