It's a function of the geometry of the shutter blades. As a leaf shutter starts to open, it forms something of a star shape, and then continues to open to the full circle, then closes again, reforming the star shape. The marked shutter speed can be thought of as the average time for the whole process. At small apertures, the effective shutter speed is longer, as only the center part is "seen" by the aperture.
Focal plane shutters are also marked with the effective shutter speed, based on the average time the shutter is either fully open (the max sync speed), or has a faster effective shutter speed as the slit passes across the film gate.