It need not necessarily be an emergency that may require some personnel to change shifts. Just as it is in the real world, I think there will always be a need for "floaters," people who work different shifts according to necessity (filling in for someone away on a mission, on leave, or due to sickness). I believe such personnel comprise only a minority of a ship's crew, but it's definitely possible for some people not to have a specific set duty shift (but a shift they generally work more than another for a time) and are plugged in whenever needed for a situation. I think generally department managers try not to have them alternating between day and night too often, but it can happen from time to time, IMO.A spaceship, just like an oceangoing vessel, runs 24-7. It never shuts down. As such, there will always be a need for some people to work shifts that aren't ideal even if only on occasion.But there's no reason to have a less than ideal schedule on a spaceship.
A case could be made that the times we do see the captain and the exec on the bridge represent special occasions or occasions in which their shifts overlap. It could be that most of time (the unaired time in a show or movie when nothing really exciting/important is going on), the captain and exec actually aren't on the bridge together.
Which is why it's possible that personnel may alternate between various shifts. But we do know from TNG's "Data Day" that there is a day watch and a night watch on the Enterprise, which was likely created as a result of most of the crew having either a diurnal or nocturnal biology.Ship's schedules are completely arbitrary since there's no external daylight cycle.
Sorry, I wasn't clear enough earlier. It's not working gamma shift that's a problem in space (the lack of natural sunlight / daylight is a non-issue, presumably humans living in space have adapted to it), nor is working gamma shift a problem biologically. The problems I listed occur when you have to change shifts (or rather sleep cycles) frequently. Certainly for enlisted crew this would be a non-issue, since if you worked beta shift, you could work that shift for the foreseeable future. More senior officers might be required to return to duty in the middle of an off-duty shift or a sleeping period for, say, diplomatic missions. I can imagine that everyone would be required to go on duty in an emergency that threatened the safety of the ship.