Continuity mistake: When the prosecutor visits the cell, Kirk's hands on the bars change positions when the camera angle reverses. From the inside, there's one bar between Kirk's hands. From outside, there are two. (00:28:10)
Continuity mistake: In Kirk's log entry, which he somehow makes from jail without a tricorder, he states that 5 witnesses heard him speak to the "spirits." This isn't true, and Kirk ought to know it. The crowd rushed in through an archway after he spoke to Spock and McCoy, and they were all too far away before to hear him. (00:10:50 - 00:26:00)
Continuity mistake: After Kirk knocks the jailer out, there's a bit of stew on the cell's door above the lock. After Kirk drags the man into the cell and closes the door, the bar above the lock is clean and dry.
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.