The wave equation is
\frac{\partial^2 \phi}{\partial x^2}= \frac{1}{c^2}\frac{\partial^2\phi}{\partial t^2}
If you use "separation of variables" you would look for solutions of the form \phi(x, t)= X(x)T(t) (separating x and t into separate functions) so that the equation becomes
T\frac{d^2X}{dx^2}= \frac{1}{c^2}X\frac{d^2T}{dt^2}
Divide both sides by XT to get
\frac{1}{X}\frac{d^2X}{dx^2}= \frac{1}{c^2T}\frac{d^2T}{dt^2}
Now the left side is a function of x only and the right side is a function of t only. In order to be the same for all x and t, each side must be equal to a constant:
\frac{1}{X}\frac{d^2X}{dx^2}= \lambda
\frac{d^2X}{dx^2}= \lambda X
This is what pasmith is referring to as the "spatial variation".
IF we are given the heat problem on a finite interval, say T(0)= T(P)= 0, then we can show that the "spatial dependence", the function X(x), must have sine and cosine solutions.
If, for example, \lambda= 0 this becomes just d^2X/dx^2= 0 so the general solution is y= Ax+ B which is NOT periodic and so cannot satisfy the boundary conditions.
If, for example, \lambda> 0 the general solution is y= Ae^{x\sqrt{\lambda}}+ Be^{x\sqrt{\lambda}}.
So \lambda must be negative. If we write \lambda= -\alpha^2, the equation becomes d^2X/dx^2= -\alpha^2 X, which has general solution Acos(\alpha x)+ B sin(\alpha x). That's where the
\frac{1}{c^2T}\frac{d^2T}{dt^2}= \lambda
\frac{d^2T}{dt^2}= \lambda c^2T
Again, that is for the heat problem on a finite interval. If we had and infinite interval, say the heat equation on x\in [0, \infty), the solutions are Fourier Transforms, not Fourier series, and are NOT periodic at all.