The solution to the Kohn-Sham equation in the density functional theory of the quantum many-body problem is studied in the context of the electronic structure of smoothly deformed macroscopic crystals. An analog of the classical Cauchy-Born rule for crystal lattices is established for the electronic structure of the deformed crystal under the following physical conditions: (1) the band structure of the undeformed crystal has a gap, i.e. the crystal is an insulator, (2) the charge density waves are stable, and (3) the macroscopic dielectric tensor is positive definite. The effective equation governing the piezoelectric effect of a material is rigorously derived. Along the way, the authors also establish a number of fundamental properties of the Kohn-Sham map.