Many pirates were often doomed if they got caught by police forces. Many countries executed pirates and made an example of them.
One way they did get medical care was to abduct the doctor who was on board another ship. They would then task those doctors with taking care of the pirates.
The doctor, basically had no other choice besides the obvious implication of walking the plank or some equally terrible fate.
Most doctors on board of these ships were rookie doctors with only minimal experience, looking to cut their teeth learning the trade at sea.
Medical care back then was not a fun practice, for anyone involved. Amputation was one of the few things they knew how to do that would actually save your life.
If you didn’t die.
