When one considers a relatively small segment of a curve, most appear approximately linear when one zooms in far enough. Most materials are not truly linear when stretched a considerable distance, but for small deviations about the equilibrium some are approximately linear. This can be seen when one considers Taylor Series expansions of functions.
The inverse square law for electrostatics can be expanded as a Taylor Series as well, and it contains a linear component as can be seen here:
$$\frac{1}{(r-r_0)^2}=\frac{1}{r_0^2}\left[1+2\left(\frac{r}{r_0}\right)+3\left(\frac{r}{r_0}\right)^2+4\left(\frac{r}{r_0}\right)^3+\cdots\right]\,.$$
For small deviations $\Delta r\approx0$, the inverse square law is approximately linear since the higher-order terms $\mathcal{O}[(\Delta r)^2]$ fall off very quickly. This can be seen using the Binomial approximation $(1+x)^n\approx1+nx$ where $x\approx0$. In this case we have:
$$(\Delta r-r_0)^{-2}=\frac{1}{r_0^2}\left(1-\frac{\Delta r}{r_0}\right)^{-2}\approx\frac{1}{r_0^2}\left[1-(-2)\left(\frac{\Delta r}{r_0}\right)\right]=\frac{1}{r_0^2}\left[1+\frac{2\Delta r}{r_0}\right]\,.$$
Of course this is far too simple to describe the more complex material effects of crystal lattices being stretched from equilibrium, but this is the general idea of how many materials can exhibit linear relationships between force and distance for small deviations from equilibrium.