A new formula is derived for elastic constants using a rigorous quantum statistical treatment based on obtaining the derivatives of the Helmholtz free energy with respect to strain elements. The stress tensor and the second-order elastic constants are formulated exactly for any homogeneous stress state by using a perturbation method applied to the Schrodinger equation. Third- and higher-order elastic constants may also be obtained in the same way. The formula for the elastic constants contains four terms, all of which are thermal averages. Two of these terms are the momentum term and the quantum stress fluctuation term. Another term involves the thermal average of the potential energy of a lattice and it reduces, in the case of two-body central forces, to the well known formula for the elastic constants of Born and Huang (1954) without making any of the following three assumptions: zero stress, sublattice equilibrium, every lattice point at a centre of inversion. The remaining term is a second-order perturbation term with energy difference denominators, and is the contribution of internal strain to the elastic constants.