Star Trek: For The World Is Hollow And I Have Touched The Sky

On stardate 5476.3, Dr. McCoy, the USS Enterprise's chief medical officer, discovers he has a rare, incurable disease called xenopolycythemia and has only one year to live. At the same time, the sensors suddenly detect a set of ballistic missiles targeting the ship; however, the Enterprise quickly disposes of the primitive weapons. The missiles' point of origin is quickly determined, and the Enterprise approaches. It is a large asteroid called Yonada which is on a deadly collision course with the Federation world of Daran V, a planet with nearly four billion inhabitants. Unless a way is discovered to divert Yonada, the asteroid will destroy the planet in just over a solar year.
When the asteroid is discovered to contain a breathable atmosphere, Kirk assembles a landing party consisting of himself, Dr. McCoy and Mr. Spock to beam into the habitable interior to investigate.
Upon their arrival, the landing team discovers several metal cylinders that strangely protrude from the ground. The team is then quickly captured by a group of humanoid men who emerge from the cylinders, along with a stunningly beautiful woman who appears to be their leader. The woman identifies herself as Natira, the High Priestess of Yonada, and orders her men to take the prisoners below.
The three officers are escorted to a chamber that appears to be some kind of temple. Natira kneels on a platform and "prays" to her god, whom she calls the "Oracle". Kirk steps forward and tries to explain that their team came in peace. Natira wants to believe the party, but the Oracle threatens severe punishment if that party is found to be enemies. As a show of force, the Oracle strikes the party with a powerful electric shock that knocks them unconscious.
Kirk and Spock awaken sometime later, however McCoy is slower to recover owing to his medical condition. Kirk tells Spock about McCoy's condition; then an old man comes into the room. The old man tells them that the others on Yonada do not know they are living in a hollow sphere and how, when he was young, he climbed a high mountain and discovered the secret for himself, saying "...for the world is hollow and I have touched the sky". As he is talking he cringes, as though in pain, and after he's done, he collapses at Kirk's feet, dead. A red glow appears under the skin at the temple of the old man's head. Natira comes into the room with a small entourage and informs Kirk, Spock and McCoy that the man has been killed by the Oracle for uttering "forbidden words". It is then revealed that the Oracle controls the people by means of an implanted device referred to as an "instrument of obedience".
McCoy's health upsets Natira who quickly shows an attachment to the doctor. Natira tends to McCoy giving Kirk and Spock an opportunity to have a look around. The two find out that the entire asteroid is artificially built. It is in fact a giant spacecraft housing millions of people. It is a fact that the Yonada people do not seem to be aware of; all except for the old man, who realized that Kirk and Spock are visitors.
Kirk and Spock then make their way to the Oracle chamber. They discover ancient texts inscribed in the wall by a race known as the Fabrini. It is learned that the Fabrini constructed the asteroid ship 10,000 years ago, before their star exploded into a supernova. They created the ship in hopes of saving members of their race, and later transplant them to a new world. All the current inhabitants of Yonada are Fabrini descendants.
Kirk wishes to get a closer look at the Oracle which he and Spock believe is nothing more than a central computer, but they hide when Natira enters the chamber to pray. She expresses to the Oracle that she wishes McCoy to become her mate. Kirk's and Spock's forbidden intrusion into the temple chamber is discovered and again they are painfully stunned and taken away to be punished for their atrocities. Meanwhile, McCoy has grown fond of Natira and expresses his desire to remain behind on Yonada, since he has one year to live. He agrees to Natira's marriage proposal only if she allows Kirk and Spock to go free.
Natira agrees, but if McCoy is to remain behind, the Oracle demands that he be implanted with a punishment device like all the others. McCoy accepts under the circumstances and Kirk and Spock are released. They attempt to convince McCoy to return with them since Starfleet will resort to destroying the generation ship if they cannot divert it, but McCoy is adamant about staying; his friends return to the Enterprise. Kirk however, never gets the chance to reveal Yonada's secret and warn Natira of its imminent doom. McCoy undergoes the implant procedure and once that is done, a marriage ceremony between him and Natira gets underway.
After his wedding, McCoy is allowed to look at the "Book of the People", the sacred text that reveals information on numerous star systems and Fabrini technology. McCoy excitedly contacts the Enterprise with his communicator about the discovery of the book, but the Oracle discovers what he is doing, and McCoy is stricken with pain by the punishment device, and suddenly communications with him are cut off.
Kirk and Spock waste no time in beaming back to Yonada to find McCoy. They locate him unconscious with Natira next to him in grief. Spock then operates on McCoy and removes the punishment implant. Kirk explains to Natira that her world is really a spaceship, and is doomed to be destroyed if she does not convince the Oracle to alter course. Believing Kirk's story Natira confronts the Oracle for the truth. The Oracle responds to her "blasphemy" with a blast of pain from her punishment implant which almost kills her.
McCoy, now free of the punishment device, rushes to Natira's side and begins to remove her implant. Kirk and Spock rush to the temple chamber to retrieve the book and find a way to shut down the Oracle computer. The Oracle becomes furious at their attempts to gain access, and the stones of the chamber begin to glow red-hot causing Kirk and Spock to retreat. Having seized the book however, Kirk and Spock figure out a way to bypass the Oracle's defenses and shut the machine down. At the same time, they discover access to a secret room with the controls to the entire asteroid ship.
With the Oracle out of the way, Kirk and Spock enter the room and learn that a malfunction in the navigation system has moved Yonada off its intended course. Kirk and Spock make the proper repairs and corrections to the ancient navigation system and Yonada turns back on its proper heading, saving itself and Daran V.
Kirk and Spock then discover the Fabrini medical records, which includes a cure for xenopolycythemia. McCoy is returned to the Enterprise for a successful treatment, but hopes to see his "wife" Natira again, once the Yonada people reach their new homeworld in just over a year.