The offset is measured in meters, but the depth is still measured in time. The extra distance the wave have traveled to a longer offset is therefor also seen as an increased time in the CMP-gather (Common Mid Point) and the extra time depends on the seismic velocity of the layers.
If the velocities are high, the moveouts are short. The longer offset, the longer distance the wave have traveled through the layer and the larger moveout correction is needed before stacking. Sometimes we mute long moveouts as they tend to be distorted and noisy.
When we stack the traces in the CMP-gather, we need the reflectors to be at the same time and to do that, we perform NMO-correction (Normal MoveOut).
To find the right velocities to use for the NMO-correction, we can do a semblance analysis to get the NMO-velocity. That is to simply try possible velocities and see at what velocity the reflector in the CMP-gather is aligned horizontally and gives the highest peak when summed for all traces.
The figure shows a synthetic CMP-gather to the left. A semblance velocity scan is performed and the peaks are shown in the middle plot. The velocities are picked as shown in the graph and are used to NMO correct the CMP-gather as seen in the seismogram to the right. When this is stacked, the reflectors will add up and the noise will be suppressed. So in theory, we don't need the velocity beforehand to perform NMO-correction. The moveout can be used to calculate a NMO-velocity model.
The figure is from Madagascar development blog.
However, if we know the velocities, eg from borehole data or refraction studies, we don't need to rely on computing heavy semblance velocity scans and uncertain velocity picking. Data are rarely so neat as this synthetic example shown here. Also, it's impossible to derive the gradually increasing velocity in a formation without internal reflectors.
The velocity we use to do NMO-correction is not the same as the velocity of the layer, but rather the additional velocity to the average needed to correct the moveout. To finally estimate the actual velocity of the layer, we can use e.g. Dix equation to correct the velocities, but more accurate methods are usually used nowadays.
This is the basic application for stacking, but there is much more to it, you can read more e.g. here.