In Federation society, a legal guardian was a person responsible for a person unable to operate as a responsible adult themselves, the latter a ward of the former. They were tasked with making decisions and looking after those persons, with their best interest in mind.
In 2269, Flint claimed Rayna Kapec was placed into his custody as a legal ward after her parents died. However, no record of this could be found in the Federation legal banks. (TOS: "Requiem for Methuselah")
In 2376, Seven of Nine became the guardian to four ex-Borg children, Mezoti, Rebi, Azan, and Icheb, despite believing that "Mister Neelix would be a wiser choice." When Captain Kathryn Janeway indicated that they established a bond with her and that they will look to her for guidance. Seven reluctantly agreed, stating that she thought that, "perhaps I could help them avoid some of the obstacles I've encountered." (VOY: "Collective") When things initially did not go as Seven had hoped, she requested from Chakotay to no longer serve as guardian to the Borg children, due to their chaotic nature. He denied her request. (VOY: "Ashes to Ashes")