Yes they can. But that requires a different type or training an skill set. McCoy showed no inclination to acquire that training or skill. Being a Lt Commander doesn't not qualify you for command.Please remember that Dr. Crusher did take the night watch from time of time. And think about hospital ships their Captain's could be doctors. So under the right conditions the CMO could be in command