(covers information from several alternate timelines)
Treason was the act of betraying one's country, organization, affiliation, or ally, usually to assist the enemy. One who commited this act was known as a traitor, and might be convicted as a criminal. Sometimes, a traitor was influenced by the enemy to commit such acts due to political or situational circumstances.
Various Starfleet-related acts of treason and traitors have been uncovered throughout history.
In 2259 of the alternate reality, Montgomery Scott asked Captain James Kirk to beam him off the USS Vengeance, noting that he had committed treason against Admiral Alexander Marcus by sabotaging the ship. (Star Trek Into Darkness)
Known acts of treason
See: Khitomer conspiracy
Klingon Civil War
See: Klingon Civil War
Known traitors to Starfleet
Admiral Cartwright was a high ranking Starfleet official in the late 23rd century. Cartwright was part of the Khitomer conspiracy that arranged the assassination of Klingon chancellor Gorkon as he traveled to negotiate with the Federation President on Earth in 2293. He was ultimately arrested for his involvement with the conspiracy. (Star Trek VI: The Undiscovered Country)
Valeris was a Vulcan Starfleet officer who served aboard the USS Enterprise-A as Conn Officer in 2293. She played a major role in the Khitomer conspiracy aboard the Enterprise-A. Valeris was taken into custody and later charged with treason. (Star Trek VI: The Undiscovered Country)
Lieutenant Commander Calvin "Cal" Hudson was attache to the Federation colonies in the Demilitarized Zone. After years of seeing the suffering and abuse of the colonists by the Cardassians, he joined the Maquis, but was uncovered by Sisko. (DS9: "The Maquis, Part I", "The Maquis, Part II") He was killed in a skirmish with the Cardassians after they allied with the Jem'Hadar in 2373. (DS9: "Blaze of Glory")
Stefan DeSeve was a Starfleet Ensign who had defected to the Romulan Star Empire in 2349. In 2369 he returned to the Federation to face treason charges and, more importantly, to deliver a message from Spock about the Romulan underground movement. (TNG: "Face of the Enemy")
Ro Laren was a Bajoran national who formerly served in Starfleet aboard the Federation starship USS Enterprise-D before finally sympathizing with, and later joining, the Maquis. Her fate remains unknown. (TNG: "Preemptive Strike")
Michael Jonas was a former member of the Maquis, who subsequently joined the crew of the USS Voyager after being stranded in the Delta Quadrant. He secretly conspired with Seska, a Cardassian spy who defected to the Kazon-Nistrim, and ultimately tried to sabotage Voyager. Jonas was killed as he fell into a plasma fire, near Voyager's warp core. (VOY: "Investigations")
Michael Eddington was a Starfleet security officer assigned to space station Deep Space 9 during the late 24th century. Eddington became disillusioned with Starfleet and the Federation, and joined the Maquis.
He was captured by his former commander, Benjamin Sisko, in mid-2373. Eddington was killed during a special operation while serving his sentence. He and Sisko were able to save several Maquis members from being killed, including his wife, Rebecca Sullivan. (DS9: "For the Cause", "For the Uniform", "Blaze of Glory")
- The Romulan admiral Alidar Jarok was lured into committing treason against the Romulan Star Empire in hopes of making a better life for his people. (TNG: "The Defector")
- Curzon Dax was falsely accused of treason by the Klaestron for revealing the location of General Ardelon Tandro. In fact, Tandro himself was the traitor, and Dax was only guilty of committing adultery with Tandro's wife. (DS9: "Dax")
- Elim Garak had wanted to invent charges of treason against Legate Porania when he was in the Obsidian Order, so he wouldn't have to "hear his voice again". (DS9: "The Die is Cast")
- Admiral Leyton was prepared to commit treason in order to save Earth from the Dominion. Benjamin Sisko believed that Leyton didn't see his actions as treasonable, but as desperate acts of patriotism. (DS9: "Homefront", "Paradise Lost")
- Senator Kimara Cretak was found guilty of treason against the Romulan Star Empire by the Continuing Committee in 2375, for illegally accessing Chairman Koval's personal Tal Shiar database. She was actually trying to save Koval's life, as she had been told by Julian Bashir that Koval was about to be assassinated by Section 31. In actuality, having Cretak accused of being a traitor was the plan all along, as it was likely she would be ejected from the Romulan Senate and Koval would take her place on the Continuing Committee. (DS9: "Inter Arma Enim Silent Leges")
- Commander Jonathan Archer committed acts of treason in the mirror universe when he destroyed the ISS Avenger and attempted to become emperor of the Terran Empire. (ENT: "In a Mirror, Darkly, Part II")