We develop the cluster self-consistent field method incorporating both electronic and lattice degrees of freedom to study the origin of ferromagnetism in Cs$_{2}$AgF$_{4}$. After self-consistently determining the harmonic and anharmonic Jahn-Teller distortions, we show that the anharmonic distortion stabilizes the staggered x$^{2}$-z$^{2}$/y$^{2}$-z$^{2}$ orbital and ferromagnetic ground state, rather than the antiferromagnetic one. The amplitudes of lattice distortions, Q$_{2}$ and Q$_{3}$, the magnetic coupling strengthes, J$_{x,y}$, and the magnetic moment, are in good agreement with the experimental observation.