In 2268, she was tested by a species called the Vians to see if her people were worthy to be saved from a supernova that was threatening her and other planets. The Vians had the power to save only one species.
Spock, McCoy, and Kirk were kidnapped by the Vians and subjected to various forms of torture to test Gem's reaction and to determine if her species was worthy of being saved. They wanted to know if Gem would help them. Apparently the Vians wanted to be certain that she and her people had learned the principles of self-sacrifice, compassion and the love of life from her contact with the Humans. These qualities would make her civilization worthy to survive.
The Vians tested Gem's capacity for compassion and how far she would go to save another being. After Kirk was tortured, Gem healed his wounds. When Dr. McCoy was tortured and near death, Gem was at first frightened by the extent of his injuries and did not help him. Then, Gem approached McCoy and moved her hands on McCoy's face, transferring his injuries to her. Gem collapsed, sobbing, and recoiled in fear because she knew that to heal him, she would have to die. She tried to help him more, but moved away in fear.
However, she overcame her fears and offered her life to save McCoy's, but McCoy refused to allow her to die and shoved her away. The Vians healed McCoy and, taking Gem with them, teleported from the laboratory. The Vians determined that her people were worth saving, and her planet was spared from destruction. (TOS: "The Empath")