The One Piece lands and oceans are ruled by the World Government. This big and powerful institution protects its dominant status through their Marine and army forces. Even though there isn't a lot of information about its history, it has been hinted that it was created after several different countries merged into one sole state. Come check out how law and order work in the One Piece universe!
The Marines are a military organization created to enforce order of the seas, although its principal function is to pursue pirates (assuming all of them are mere criminals). Its main headquarters are located in Marineford, a fortress island where all the highest commands reside.
The Fleet Commander is the highest position in the Marine hierarchy, followed by three admirals, vice-admirals and other lower ranks. The admirals are the strongest marines and, with the Shichibukai, they counterbalance the strength of the four Pirate Emperors.
The law enforced by the World Government is designed, principally, to protect the social hierarchy. While pirates are pursued just for being pirates, the Mariejois World Nobles are allowed to enslave, kill and torture any living creature they wish to. Besides, they are the only civilians that can use a Buster Call (an alarm that, when triggered, will immediately bring an admiral to protect the World Noble that activated it).
Meanwhile, many other countries are left to their own luck when terrorized by pirates or other kinds of villains. Apart from these injustices, the World Government has showed a lack of preoccupation for the security of common people, preferring to maintain a social image before helping the endangered.
There isn’t much information about how justice is administered. There hasn't been any type of trial since Tom was tried in court for supposedly breaking the law during the “Water Seven Arc”. Once captured, pirates seem to be sent directly to prison, without any kind of legal defense. The most dangerous of them are imprisoned in Impel Down, a huge underwater stronghold divided into six levels that distinguish the pirate’s potential threat. Prisoners are submitted to different kinds and degrees of physical work and torture in each of the Impel Down levels.
The marines don't pursue pirates because they present a danger to the normal people, but because their lifestyle represents a threat to the World Government’s absolute power. Being so, they don’t mind forming alliances with specific pirates if it helps them to fight the strongest ones.
The World Government is an oppressive institution that mainly only seeks the benefit of a few. One Piece shows us that being a pirate is more than raiding and hunting for treasures; it’s about fighting for freedom.