Atavachron
The Atavachron was a computer device utilized on the planet Sarpeidon to prepare its inhabitants for use of a time portal, by altering the user's cellular structure and brain patterns for survival in their selected time period. Without processing by the atavachron, one could only survive in that time period for a matter of hours. With processing, the user could survive in 'their' new time, but they would die instantly if they were to attempt to return through the portal.

The Sarpeidon female Zarabeth was banished to that planet's ice age by the dictator Zor Kahn for her association with dissenters.

In 2269, the  arrived at Sarpeidon as their sun was about to go supernova. They discovered that the planet's inhabitants had utilized the time portal to travel to various points in their planet's past to escape destruction, and met the last inhabitant, Mr. Atoz, a librarian who had helped the inhabitants choose their destinations by using a library of verism tapes, which detailed information on the time periods. 

During their visit, Captain Kirk, Commander Spock, and Doctor McCoy accidentally traveled through the portal, Spock and McCoy arriving 5,000 years in the past where they met Zarabeth. While there, Spock began to regress to the behavior of Vulcans of that time period, displaying increased emotionalism and an inability to control his aggressive tendencies. Eventually, all three of them were able to return through the portal, as they had not been processed through the Atavachron. ()

Appendices

Background information

The Atavachron, whose name comes from a Latin word meaning "ancestor" and a Greek word meaning "time", was a recycled set piece that was previously used as the Beta 5 computer in the second season finale .

According to deleted references from the  final draft of the script, Zarabeth was in her second year of banishment before the landing party from the Enterprise arrived on Sarpeidon; however, in the planet's corresponding "real time", Zor Kahn had been out of power for over a century since she had been removed to the past.

Apocrypha 
The novel Yesterday's Son offers expanded explanations for several of the atavachron's functions, explaining many of the more confusing aspects of the episode.  "Preparation" is stated to alter the mental patterns of a person from the future, so that they would not return to an early time and attempt to alter history by interfering with historical events or introducing advanced technology.  When Spock and McCoy find themselves in a frozen waste with their phasers inoperable, it is later revealed this was a security measure of the atavachron to prevent a time traveler from bringing an advanced weapon into the past and conquering a more primitive people.  The atavachron, however, did not deactivate benign advanced technology, explaining why Spock can still use a functioning medical scanner to assess McCoy's health.

de:Atavachron
Computer technology
Time travel technology