Piracy and privateering in medieval times have been neglected in popular history for a variety of reasons. The two golden ages of piracy were in early Roman times and the Early Modern period, not the Middle Ages. But even without Johnny Depp camping it up as Jack Sparrow, this period didn't lack for colorful pirates.
The Mediterranean has been a particularly vulnerable area for over three thousand years. Some of the most famous ancient heroes-notably Odysseus and the Argonauts-provisioned themselves on their voyages through piracy. Mediterranean pirates like the Illyrian Navy harried ancient mariners until Caesar's great rival, Pompeii, crushed them in the middle of the first century B.C. E. Ironically, Pompeii's son, Sextus, later turned pirate against Caesar's nephew, Octavian.
The fall of the Roman Empire in the west and the rise of Islam in the east brought a new age of piracy. Muslim pirates operated out of the Balearics (Mallorca and Minorca) off the northeastern Spanish coast in the 10th century. Sicily was constantly hounded by Muslim pirates until it became a haven to them after its conquest in the late ninth century. In the north, Viking raiders devastated the British Isles and northern France, then explored the North Atlantic. Sicily was reconquered in the 11th century by the Normans, whose ancestors had been pagan Viking pirates-turned-Christian knights.
The Crusades saw a renewed interest in shipping from the west to the Holy Land. But Western Europeans did not come up with really effective ways to combat pirates until the late 13th century. Privateers from the military orders like the Templars and Hospitallers harried Muslim pirates, even after the fall of Acre in 1291.
In the late 14th century, the Hanseatic League successfully warded off attacks by the Victual Brothers. After the fall of Constantinople in 1453, the Ottoman Empire used privateers to prey on Christian shipping and ports. This was the origin of the Barbary Coast (North African) "pirates" who remained a threat until the late 18th century. The Hospitallers, now the Knights of Malta, struck back with their own privateering ships and fleets.
Medieval piracy and privateering are part of a continuum in piracy and warfare, not a separate history. The great age of piracy began in the Middle Ages and continued for another five centuries. Piracy even exists today. As long as there is an ocean, there will probably be pirates.