Starfleet sends the Enterprise to the planet Argo, formerly a land planet until volcanic disturbances caused the seas to rise. Kirk, Spock, McCoy, and Clayton take a special aquashuttle down to the planet near the only remaining major land mass. Their mission is to determine what caused the eruptions and hopefully find a way to stop a similar catastrophe on a Federation planet. The aquashuttle lands in the ocean and Spock and McCoy prepare to take samples.
A large amphibious creature, a sur-snake, attacks the aquashuttle. Spock stuns it with the shuttle's phasers and they submerge to examine it further. McCoy confirms that it has a duel respiratory system, just as it recovers earlier than expected and smashes into the aquashuttle. They return to the surface and try to fire, only to discover the phasers were damaged in the impact. Before Kirk can request transport from the Enterprise, the sur-snake throws the ship into a nearby rock. McCoy and Clayton are thrown clear but Kirk and Spock, unconscious, are trapped in the wreckage. The sur-snake grabs the aquashuttle with its tentacles and submerges back into the ocean.
Scotty checks in, discovers the aquashuttle is non-responsive, and rescues McCoy and Clayton. They search for Kirk and Spock for the next five days without success. As they widen the search area, they spot the aquashuttle on an outcropping. They find Kirk and Spock in a nearby tidal pool, clearly submerged for some time. When the rescue party pulls them out of the seawater, hoping that they might still be alive, the two officers respond. However, they're unable to breathe and they clutch at their throats with webbed fingers. McCoy realizes that they are now water-breathers and can't survive in an oxygen atmosphere.
McCoy has his friends beamed up to the Enterprise and placed in a seawater-filled chamber in Sickbay. They have no memory of what happened to them, and McCoy confirms that there is an unidentified substance in their blood that was infused via injections. There is no record in the Federation databanks of such a technique and Spock points out that an advanced civilization on Argo must be responsible. No such civilization was detected on the sensors, suggesting that they live on the ocean's bottom. Without the aquashuttle they can't conduct an extensive survey, but Kirk points out that they are now adapted to explore the ocean depths. McCoy objects, pointing out that they don't know the risks, but Kirk and Spock point out that they can't function as Starfleet officers in their current condition, and there's no guarantee they can survive in anything other than Argo's waters. They can only hope to contact the people that saved them and convince them to reverse the process.
Kirk and Spock descend into the ocean and find a group of green-skinned amphibious humanoids farming the kelp beds. The natives order them to leave, saying that the young among them saved them and they want no part of the officers. When they swim off into a nearby tunnel, Kirk and Spock follow at a distance and discover an advanced underwater city. When they try to sneak in, the locals easily capture them and take them to the Council of Tribunes. The council leader, Domar, declares the officers spies from the surface world, just as the ancient scrolls warned. A young Tribune, Rila, speaks up, pointing out that the newcomers didn't come as spies. Domar complains that the young Tribunes are always trying to dismiss the words of their ancestors.
When Kirk asks for a hearing, Domar has the net removed and they admire the transformation they performed. He explains that they saved the officers because they're not murderers, but they erased their memories so they couldn't return. Another elder, Cadmar, believes that Kirk and Spock are spies, but Rila demands that they be allowed the chance to defend themselves. Domar agrees and Kirk explains that they come from anther planet. The elder Aquans refuse to accept the possibility and insist that they are their old enemies, the surface-dwellers. When Kirk says that they only came so that the Aquans could reverse the transformation, Domar tells him that there is no cure.
On the surface, Scotty waits in the skiff. McCoy calls from the Enterprise to tell him that they've detected signs of a coming quake in four hours. Kirk and Spock are scheduled to check in at the same time, and Scotty decides to take a landing party using the glowing forcefield belts to find his friends. As they follow the tracking devices, the Aquans see them coming and assume that it's an attack.
In the council chamber, Kirk invites the Tribunes to inspect the aquashuttle wreckage and confirm that he and his people have technology foreign to Argos. Rila agrees with Kirk, but a messenger arrives to tell them that more surface-dwellers are coming. Domar assumes that it's an attack and tells his soldiers to secure Kirk and Spock above the waterline and let them slowly suffocate.
Kirk and Spock are taken away and fastened to the rocks with mesh. As they slowly suffocate, Rila comes to free them. When she's unable to break the mesh, Kirk tells her to go to the large island and brings his friends.
When Scotty and the others return from their aborted expedition, Rila arrives and takes them to Kirk and Spock. Once Scotty frees them, he warns Kirk about the coming quake. Rila explains that a similar quake caused the surface cities to sink below the waves, destroying much of the ancient knowledge. Some natives used the ancient medical techniques to mutate themselves into water-breathers to survive, and the mutations became hereditary. Since much of their technology and civilization, they reverted to savagery. Rila explains that there is a reversal process, but the procedure is banned and the knowledge hidden away in the surface-dwellers ruins. With less than two hours until the next quake, Kirk convinces Rila to lead him and Spock there.
Rila leads Kirk and Spock to the barrier reef surrounding the ruins. She points out the passage leading through, which is swept by tidal currents. The two officers ride out the current and get inside, and find a vast sunken city. Exploring, they find a laboratory with symbols showing transformational mutations. On the shelves are cylinders containing the records and they grab them and swim out. A sur-snake attacks them as they leave, but a small quake brings down part of the barrier reef on top of the creature, allowing them to escape.
Back on the Enterprise, McCoy translates the scrolls and confirms that they describe the reversal process. However, the anti-toxin requires the venom of a sur-snake. Kirk and Spock return to Argo and meet with Rila and her friends. They ask for their help and the others nervously point out that Domar has forbidden the capture of sur-snakes. Rila overrides them, saying that they need the Enterprise's help and access to the ancients' knowledge to save their city from the coming quake.
The young Tribunes accompany Kirk and Spock back to the surface-dweller ruins and find a sur-snake. The Tribunes try to hold it in place with a net while Kirk and Spock draw some of its venom. They manage to get some and escape as the sur-snake rips its way free.
When the two officers return to the Enterprise with the venom, McCoy prepares the anti-toxin but warns them that they didn't get all of the records. The ones that are absent describe the proper dosage, and McCoy warns his friends that an overdose can cause irreversible mutation. They don't have enough venom to continue extensive tests and it's unlikely Rila and her friends will mount a second expedition. McCoy begins with Kirk and administers the timed series of injections. Kirk's webbing and gills starts to fade, but when McCoy gives him the last injection his metabolism goes into overdrive. The captain begins growing scales and a back fin, but the transformation finally reverses itself. They get Kirk out when he starts breathing air again and then repeat the process with Spock.
Once both officers are restored to normal, the ship's science department analyzes the records and determines where the epicenter of the quake will occur. Kirk brings Rila and Domar aboard, providing them with rebreathers, and they watch as the Enterprise crew prepare to save their planet. Sulu uses the phasers to relieve the pressure areas in the epicenter, diverting it to an uninhabited area.
Once the seabed stabilizes, Kirk and Spock beam down with their new friends. The ancients' city has resurfaced because of the redirected quake, and Domar and Rila thank Kirk for his help. They offer all of the ancient records to help other planets and Rila says that the younger ones plan to use the reversal process to live on the surface. The older Aquans are too set in their ways to try going back, but Domar vows to make sure that both sides won't lose contact with the other.