It's not "arr" but "yarr," meaning "yes," and it comes entirely from actor Robert Newton's portrayal of Long John Silver in the 1950 Walt Disney film Treasure Island. Newton was from Dorset and spoke with a strong West Country accent. His performance in that film was so influential that it cemented the notion of a stereotypical "pirate accent" … which is just a Dorset accent, usually exaggerated by somebody who's never been within a hundred miles of Dorset.
This subject has been covered a few times before, I would recommend you check out our Frequently Asked Questions section on Pirate History (click here)