Possibly rather than turning north, the furthest the Barbary Pirates go is west into the Atlantic, seize these islands, then they're subsequently incorporated into the Ottoman Empire in their attempts to wrest control of North Africa? I'm not sure about the viability of Barbary pirates being able to sail across the Atlantic though, naval history is really not my forté
That's a stretch IMO, but I think any viable situation is going to involve a lot of autonomy for these islands from the Ottomans.