Time-lapse traveltime shifts of reflection events recorded above hydrocarbon reservoirs can be used to monitor production-related compaction and pore-pressure changes. Existing methodology, however, is limited to zero-offset rays and cannot be applied to traveltime shifts measured on prestack seismic data. We give an analytic 3D description of stress-related traveltime shifts for rays propagating along arbitrary trajectories in heterogeneous anisotropic media. The nonlinear theory of elasticity helps to express the velocity changes in and around the reservoir through the excess stresses associated with reservoir compaction. Because this stress-induced velocity field is both heterogeneous and anisotropic, it should be studied using prestack traveltimes or amplitudes. Then we obtain the traveltime shifts by first-order perturbation of traveltimes that accounts not only for the velocity changes but also for 3D deformation of reflectors. The resulting closed-form expression can be used efficiently for numerical modeling of traveltime shifts and, ultimately, for reconstructing the stress distribution around compacting reservoirs. The analytic results are applied to a 2D model of a compacting rectangular reservoir embedded in an initially homogeneous and isotropic medium. The computed velocity changes around the reservoir are caused primarily by deviatoric stresses and produce a transversely isotropic medium with a variable orientation of the symmetry axis and substantial values of the Thomsen parameters ε and δ. The offset dependence of the traveltime shifts should play a crucial role in estimating the anisotropy parameters and compaction-related deviatoric stress components.