And the Children Shall Lead - S3-E4
Other mistake: At the end of the episode, Kirk commands the Enterprise to Star Base 4. Earlier in the episode, there was an unsuccessful attempt to beam up two crewmen left on the planet Triacus. They evidently remain there to this day.
Answer: Kirk was getting his physical and Dr. McCoy probably turned off communications, because if he hadn't, Kirk would have left and headed straight for the bridge, leaving McCoy irritated.