Short answer
In the Ramayana, Tara is the wife of Vali, the vanara king of Kishkindha. After Vali dies in his fight with Sugriva, Tara becomes the wife of his younger brother, Sugriva. Some retellings tell the story differently, so the answer depends a little on which version you read.
Vali, her first husband
Vali rules Kishkindha, a kingdom of vanaras, a people the epic often pictures as monkeys. In the tradition he is a son of Indra. Tara and Vali have a son, Angada, who later becomes crown prince and joins Rama’s army. In the Valmiki Ramayana, Vali calls Tara the daughter of Sushena, a vanara physician.
How she came to Sugriva
The two brothers fall out after a cave episode. The asura Mayavi fled into a cave, and Vali followed him, leaving Sugriva outside. When Vali did not come back, Sugriva assumed he was dead. He sealed the cave with a boulder, became king, and took Tara. When Vali returned, he drove Sugriva out and took Tara back.
Vali later died when Rama shot him from cover during his fight with Sugriva. Rama had agreed to help Sugriva. Afterward, Sugriva became king and took Tara as his queen.
Was there a marriage?
The Ramayana does not describe a formal wedding between Tara and Sugriva. Commentators generally explain the union as the remarriage of a widow, and that is how many readers understand it.
Other versions
Some versions reverse the order and make Tara Sugriva’s original wife, whom Vali took. In the Thai Ramakien, Vali seizes Tara. In the Telugu Ranganatha Ramayanam and a Tamil folk tale, she is shared between the two brothers.
Tara and Ruma are different
Ruma is Sugriva’s own wife in the main account, the one Vali took during their quarrel. Some online sources mix up the two names and describe Ruma as another name for Tara. In the most common version, they are separate figures.
Her advice to Vali
Her marriages are only part of her story. Before the final fight, Tara warned Vali that Rama was backing Sugriva and urged him to make peace. He refused.
Tara is also one of the Panchakanya, five women named in a traditional prayer. Readers who ask “Why is Tara panchakanya?” are asking about her place in that prayer, which is a separate question from her marriages.