The Shichibukai were incredibly powerful pirates in the One Piece world who were basically affiliated with the World Government. To counter piracy, the World Government designed a method that employed these powerful pirates to fight other pirates. This eased the pressure off of their shoulders and curbed the age of piracy in many ways. Of course, this also gave these powerful pirates the freedom to do anything without facing persecution.