It seems as though every episodic TV series produces at least a couple of head-scratching, out of left field episodes during their run. For the original Star Trek, one of those was "Shore Leave" (which first aired on December 29, 1966 as part of Season 1).
In this Allison Pregler video, she makes good hearted fun at this wack-a-doodle, kitchen sink special that they allegedly made up as they went along. Part of the weirdness of it was due to a miscommunication. The episode was written by none other than Theodore Sturgeon. The network was concerned the resulting script was too surreal. But wires got crossed with operational producer Gene L. Coon and he thought he was supposed to make it even wackier. Which he did. The NBC costume and prop departments definitely had fun with it.