Longitudinal wavelength

The wavelength of any wave is the distance between two consecutive points that are in phase.

In terms of a longitudinal wave though:

The wavelength of a longitudinal wave is the distance between two consecutive compressions or rarefactions in the wave.

Basically, we measure the distance between two of the compressed bits (next to each other) or two of the less-dense bits (again, next to each other) in the wave.