Players are allowed to leave the scrum once the ball has been legally won by their team or if the scrum collapses and the referee signals to end the scrum. Leaving the scrum prematurely, especially before the ball is available for play, can result in penalties for the player’s team. Proper timing and communication among players are essential to ensure safe and coordinated exits from the scrum, allowing for seamless transition to the next phase of play.