Magnetic fields affect the motion of electrons and the orientation of spins in solids, but are thought to have little impact on crystal structure, particularly in compounds with low magnetic susceptibility, such as antiferromagnets. Here we describe an unexpected magnetic effect on crystal shape, in which the direction of the crystal's axes are swapped and the shape changes when a magnetic field is applied; this in turn induces curious memory effects in resistivity and magnetic susceptibility. Ironically, this phenomenon occurs in one of the most well-studied two-dimensional antiferromagnets, La2−xSrxCuO4.