The 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.

Time portal

Spock and McCoy enter the Sarpeidon time portal.

In 2269, the USS Enterprise 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. 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. (TOS: "All Our Yesterdays")

Some interpretations suggest that Zarabeth was banished just a few years before the landing party from the Enterprise arrived on Sarpeidon; however, there is no discussion of how old the atavachron is or how long ago Zor Kahn ruled the planet. Given the nature of time travel, this could easily mean that Zor Kahn ruled decades or even centuries beforehand.
The atavachron, whose name comes from a Latin word meaning ancestor and a Greek word meaning time, is clearly the same set piece that was used for the Beta 5 computer in the second season finale "Assignment: Earth".