A magistrate was a public official similar to a judge. Several worlds used magistrates in their justice systems.
In 2369, a Bajoran magistrate named Faren Kag informed Deep Space 9 that there was a medical emergency in his village and requested assistance. Commander Sisko sent Doctor Bashir and Chief O'Brien to aid the emergency. (DS9: "The Storyteller")
Shortly after the Bajoran poet Akorem Laan's emergence from the Bajoran wormhole, having been stuck there for two hundred years, he became the Emissary of the Prophets for a brief time and reinstated the D'jarra caste system. When Vedek Porta pushed a Bajoran man off the second level of the promenade, killing him for refusing to begin a new life under his proper caste, Akorem said he would ask the magistrate to be lenient with Porta. (DS9: "Accession")
In 2372, Quark tampered with the replicators on the USS Defiant and Deep Space 9, causing users of the replicators to see advertisements for his bar. While Quark attempted to rationalize and play down his actions, Odo sarcastically reassured him, "I'm sure the magistrate will take that into consideration when he calculates your fine." (DS9: "The Quickening")
In 2375, the Changeling Laas got into a fight with several Klingons aboard DS9 and killed one of them. General Martok requested that Laas be detained until the magistrate could determine whether to honor the Klingon Empire's request that Laas be extradited to their jurisdiction. (DS9: "Chimera")
Jonathan Archer and Travis Mayweather had to undergo a hearing in front of the Tandaran magistrate on Tandar Prime in order to be cleared of espionage and released back to the Enterprise. (ENT: "Detained")
The Klingon Empire utilised magistrates during the mid-22nd century. In 2152, an unmamed magistrate resided over the trial of Jonathan Archer on Narendra III. In 2154, a Klingon prisoner which was being prepped for genetic experimentation, demanded to see his magistrate. (ENT: "Judgment", "Affliction")