Let's take the Golden Age of Piracy, for this topic. How was the profile of someone who would embrace the life on sea? Poor/Rich? Family men? Workers? Farmers? Did they only accept men with military/sailing experience or the pirates followed the "rookies welcome" style of recruitment? Did they have any source of "code" that forbid certain classes (based on religion, skin color, etc.) to join them? Basically, how the life of someone would be like for that person to think that piracy was the right lifestyle choice?
Two types first of all. There's plain piracy and then there's privateering. I'm sure you're aware of the difference, but I'll non the less state them for sake of clarity. Privateering consisted of sanctioned commercial raiding, sorta like a private military company getting payed for raiding the merchant ships of a enemy nation. Through the famous letters of marque, like a license to pirate, haha. This is actually where most plain pirates started out and being independent it was easy to find a prize outside the letter of marque and already here we see a grey zone... William Kidd, for instance, began as a legitimate British privateer but was later hanged for piracy (Ritchie, Robert C. (1986). Captain Kidd and the War against the Pirates. Cambridge: Harvard University Press).
Now to return to your question, who would be attracted to become a "real pirate" and not a privateer. Usually all such people have a similar background with life of crime, escaping justice or just failed enterprises at home - like your farmer or worker. The common denominator is essentially that they're no longer welcome within "civilized Europe" and trying their luck within the new world ended up with becoming pirates. There's also the whole bit with freed slaves, wanting to free more of their own people or just plain revenge. Or one could argue fighting is all they know.
But more importantly, the amount of trade circulating the areas in question was absurd and every nation involved was virtually at war with each other. So it was really tempting to obtain a obsolete warships or refitted merchant ship and then proceed to welcome any hands aboard at the various ports aboard. Since these were often private endeavors, they could not rely on really having too many requirements. So while of course men with experience were more welcome the "code" that you ask about probably existed for sure, must've been some blatant racism and alike aboard ships however I cannot stress enough that the variety was immense. This can further be expanded into more experienced and well-known crews only recruiting other true veterans while complete novices taking in anyone and only going after small prizes. Just look at the legendary pirate captains and how much of the prestige was for pirates who used to sail with them. It's also important to note that people with certain skills were very valued, such as not executing cooks or surgeons aboard enemy ships but rather bringing them in. This further reflects the uneducated nature of the people within the profession in general (Konstan, Angus (2008). The Complete History of Piracy. Osprey Publishing).
Finally as for justification of that life. That's a bit harder and more open to interpretation. But as most of them were criminals or just had really bad blood between them and their home country or even Europe in general. It's likely they were just looking out for number one or arguing that the place is already a warzone - all they're doing is taking bits from the superpowers who don't need anymore. There's a series with this very theme and a romanticized notion of fighting for freedom and against England in particular that's worth checking out called Black Sails http://www.imdb.com/title/tt2375692/