The Sacrifice of Gamora was the result of an attempt by Thanos to obtain the Soul Stone.

Background

An adopted daughter of Thanos, after the Massacre of the Zehoberei, Gamora was asked by the Mad Titan to locate and retrieve the Soul Stone, which Thanos needed to complete his Infinity Gauntlet and fulfil his project of exterminating half of all life in the universe.

Gamora successfully retrieved a map leading to the Soul Stone on Vormir. However, she chose not to reveal her achievement to Thanos, instead pretending that she had failed and burning the map.

However, Thanos was not fooled by Gamora's lies and knew that she had found the location of the Soul Stone. Some time after Ego's Expansion, Gamora's sister Nebula infiltrated the Sanctuary II, and attempted to assassinate Thanos, only to be thwarted and kept in custody. Probing Nebula's cybernetic memory banks, Thanos's suspicions were confirmed, that Gamora knew of the Soul Stone's location and had secretly admitted it to Nebula.

Having decided to move further in his quest, Thanos lured the Guardians of the Galaxy, to which Gamora belonged, to Knowhere, where he took the Reality Stone, and ambushed them. Before Star-Lord could kill Gamora to prevent the knowledge of the Soul Stone falling into his hands, Thanos captured Gamora, taking her back to the Sanctuary II.

Despite Gamora's attempts to lie, Thanos revealed that he knew Gamora had found the Soul Stone, through the memories of the captive Nebula, and began to brutally torture her to force Gamora to reveal its location.

Unable to let her sister die, Gamora eventually caved in, and revealed the location of the Soul Stone to Thanos, on Vormir. To confirm this, he and Gamora left for Vormir, with Thanos threatening to kill Nebula if Gamora was found to be lying.