Star Trek: Asterisk "The Ambergris Element"

Vital Information
Series: The Animated Series
Episode: S01E13
Air Date: Dec 1, 1973
Written by: Margaret Armen
Directed by: Hal Sutherland

While examining an ocean planet, Kirk and Spock magically turn into water-breathers.

So, the deal is that the Enterprise has to study this ocean planet because it was overcome with seismic activity that put its oceans over the entire surface and there's another planet that's about ready to do the same. They have to find out how it happened so they can prevent a disaster on this other planet. What they didn't count on was Kirk and Spock turning into fish-men.

Ok, not full-on, green skinned, scaly, finny fish-men, but they do have to breathe water and they do have secondary eyelids. (Or, in Spock's case, tertiary.) Bones tries to figure it out, but they decide that the only way deal with the malady for now is to put them back on the planet where they can live in the ocean at least for a little while. While there, they meet a race of real fish-men: the Aquans.
Hi, I'm an Aquan, and this is my crib.
The Aquans are totally distrusting of the former air-breathers. They're about to do away with Kirk and Spock, but the officers plead for their lives and the lives on the planet they're trying to help by studying this planet. Well, the Aquans eventually tell them that they used to be air breathers a long, long time ago, but they were changed by the same thing Kirk and Spock were changed by. There's a cure, but it's hidden away in some deep cave or something.

So they go after the cave and fight with a big snake-lobster creature and find the book that holds the cure. They bring it back up to the Enterprise and find that what they need is the venom from that big snake-lobster creature... so they go right back down. With some help from the Aquans, they snag a tooth from the monster and then Bones creates an antidote.
AND IT... worked?
After a series of trial and error tests, the cure eventually works, and, by the way, there was an earthquake back down on the planet that revealed a new landmass. THE END!

Overall Thoughts
Of all the science in all the galaxies in all the universe... you had to walk all over mine. Let's talk about the science of turning an air lung into a water lung, shall we? No? Because you already understand how complicated it should be? Ok, that's fair. Apparently, all it takes is some mysterious ~~unknown hormone~~ on this planet. WHO KNEW?!