A pirate is an individual who robs others of their money or possessions, typically aboard their ships or starships. A pirate who operates on behalf of a government is known as a privateer. Pirates were often rash and brazen individuals, accustomed to pillage, strife, and murder, and in some ways comparable to barbarians.
In the 2150s, the crew of an Osaarian merchant ship turned to piracy to survive after being trapped in the Delphic Expanse. They attacked the Enterprise in 2153, after it had been disabled by a spatial anomaly. (ENT: "Anomaly")
James T. Kirk once remarked that he always thought Mr. Spock was a pirate at heart, due to his counterpart from the mirror universe fitting in to such an environment "so easily". (TOS: "Mirror, Mirror")
Mercenaries and pirates were still active in the 24th century. The USS Enterprise (NCC-1701-D) nearly fell prey to pirates several times. Ferengi pirates took control of the ship but were thwarted by Captain Jean-Luc Picard and several other members of the crew who, due to a transporter accident were children. Picard had run into Ferengi pirates before, as captain of the USS Stargazer years earlier. (TNG: "Rascals") Additionally, a group of mercenaries boarded the Enterprise while it was undergoing a Baryon sweep, to steal particles used for explosives. Picard thwarted them, and managed to keep the sweep from killing him. (TNG: "Rascals", "Starship Mine")
The video games Star Trek: 25th Anniversary and Star Trek: Judgment Rites, set in the late-2260s, featured a clan of pirates known as Elasi (β). Elasi ships were a hodgepodge of old Klingon battle cruisers , which were fast and maneuverable but fragile. These frigates were equipped with phasers and photon torpedoes.
Towards the end of Star Trek: 25th Anniversary and throughout Judgment Rites, the Elasi made an alliance with the Romulan Empire, who provided the pirates with cloaking devices. The Elasi retrofitted their ships with these devices, along with other modifications such as 3 forward firing photon torpedo tubes. Elasi pirates were responsible for 46 attacks against the Federation between 2267 and 2269. During that time they were considered a "Class I Threat" to the Federation.