Time-distance helioseismology (Duvall et al.) measures the signal due to solar oscillations at any two points on the surface of the Sun and cross-correlates them to obtain the time taken by the signal to travel between the two points. The travel time provides information on the solar interior through which the oscillations propagate. Traditional helioseismology, on the other hand, studies the mode structure of the power spectrum of the oscillations, which also provides information on the internal structure of the Sun.In this paper, a theoretical basis for time-distance helioseismology is presented. Its departure from traditional helioseismology is described. The theory can be applied to any dispersive or nondispersive medium. In time-distance helioseismology, it provides a method of computing theoretical cross-correlation functions from solar models for the signals of acoustic-gravity waves measured at any two points on the solar surface. One of the applications of time-distance helioseismology will be to measure subsurface flows and rotation. The theory provides a method of computing theoretical cross-correlation functions from solar models in the presence of any subsurface flow, or rotation.