How does force change the shape of an object?
Force applied causes deformation in the object. It changes the relative positions of constituent particles in the crystal lattice.
As soon as that happens, the interatomic or intermolecular forces come into play and they, tend to restore the solid back to it's original shape.
This restoring force per unit area is called Stress . When external forces are removed, the internal forces tend to restore the solid back.
This property is called Elasticity .
However, no material is perfectly elastic and what happens is that, the body is not able to restore itself completely.