Essentially it has to do with the interval that the series is defined for. The length of the interval is 2L while [itex]\pi[/itex] is the normalization (based on the fact that sines and cosines have period [itex]2\pi[/itex]).
We're requiring that the fundamental frequency is periodic in space, with spatial period ##2L##. So we have for the fundamental frequency: $$\cos \omega x = \cos(\omega(x+2L)) = \cos(\omega x + 2L \omega) \Rightarrow 2L \omega = 2\pi \Rightarrow \omega = \frac{\pi}{L}$$