During muscle contraction, the Z lines move closer together as the sarcomeres shorten. This process, known as the sliding filament theory, involves the sliding of actin filaments over myosin filaments, resulting in the shortening of the sarcomere and, consequently, muscle contraction. The Z lines serve as the anchor points that allow this sliding action to occur efficiently.