It's true that victims of piracy would have had reason to exaggerate the atrocities committed against them and vice versa so it's a little difficult to say exactly how common such things were, but rape definitely did occur and there are many mentions of it in contemporary accounts, although in general rape would have been very rare simply because there usually weren't women aboard ships. On the other hand, some pirate articles (or codes) explicitly forbid rape such as those of John Phillips in 1723. Not all pirates were equally brutal and how female prisoners were treated would have depended on the circumstances and character of the crew but in general it would not have been good and there would have been much to fear.
One account of a brutal gang rape and murder committed in 1721 by pirates led by Thomas Anstis is taken from the book A General History of Pyrates by Charles Johnson (possibly a pseudonym for Daniel Defoe) published in 1724:
"This ship ... was taken off Martinico [Martinique], wherein Colonel Doyly of Montserrat, and his Family were Passengers. The Colonel was very much abused and wounded, for endeavoring to save a poor Woman, that was also a Passenger, from the Insults of the brutish Crew; and the Pyrates prevailing, twenty one of them forced the poor Creature successively, afterwords broke her Back and flung her into the Sea. ... that such a Fact was done, there is too much Evidence for it to be doubted of."
Another much larger scale incidence of rape and murder is recorded in 1695 when the pirate crew of Henry Avery captured the flagship of the Mughal fleet in the Indian Ocean which had many female passengers and women onboard. John Gayer, president of the English East India Company, wrote:
"It is certain the Pyrates, which these People affirm were all English, did do very barbarously by the People of the Gunsway and Abdul Gofor's Ship, to make them confess where their Money was, and there happened to be a great Umbraws Wife (as Wee hear) related to the King, returning from her Pilgrimage to Mecha, in her old age. She they abused very much, and forced severall other Women, which Caused one person of Quality, his Wife and Nurse, to kill themselves to prevent the Husbands seing them (and their being) ravished."
An insight into what might have happened even in cases when pirate articles seem to forbid rape is given in A General History of Pyrates. This occurred on Bartholomew Roberts' ship in 1721:
"VI. No boy or woman to be allowed amongst them. If any man were to be found seducing any of the latter sex, and carried her to sea, disguised, he was to suffer death; (so that when any fell into their hands, as it chanced in the Onslow, they put a sentinel immediately over her to prevent ill consequences from so dangerous an instrument of division and quarrel; but then here lies the roguery; they contend who shall be sentinel, which happens generally to one of the greatest bullies, who, to secure the lady's virtue, will let none lie with her but himself.)"
However, in 1723 the pirate John Phillips in his articles much more explicitly forbids rape ("IX. If at any time you meet with a prudent Woman, that Man that offers to meddle with her, without her Consent, shall suffer present Death.") and he is known to have been a member of Thomas Anstis' crew during the gang rape and murder of the female passenger in 1721 so it's possible he may have included that clause out of genuine determination not to let that happen under his command.
Follow up question.
How would the bastard of such an event be treated? Would they be ostracized? Treated as another member of the family?