  We consider magnetostriction in magnetic materials. Starting from a
microscopic lattice model of the magneto-elastic coupling, we derive the
continuum magnetostriction Hamiltonian in cubic ferromagnets and
antiferromagnets. In ferromagnets, our results agree with established results.
In antiferromagnets, we find a new central contribution which reflects the spin
ordering. The additional term is essential in certain antiferromagnets where
magnetic moments order in antiparallel ferromagnetic planes characterized by a
normal axis. In such antiferromagnets, we predict that the magnetostrictive
strain depends on the direction of the normal axis. Our findings are relevant
for materials such as NiO and CoO, where there is a new spin-structure
dependent strain, but not in RbMnF$_3$. We propose an experimental procedure to
verify the importance of our findings in NiO that can be readily generalized to
other materials. We also generalize the theory to include long-wavelength
magnetoelastic coupling. We expect that the spin-structure dependent term
critically affects the magnon-phonon coupling.
