The structural and magnetic anomaly of the layered compound SrFeO$_{2}$ were examined by first principles density functional calculations and Monte Carlo simulations. The down-spin Fe 3$d$ electron occupies the $d_{z^2}$ level rather than the degenerate ($d_{xz}$, $d_{yz}$) levels, which explains the absence of Jahn-Teller instability, the easy ab-plane magnetic anisotropy and the observed three-dimensional (0.5, 0.5, 0.5) antiferromagnetic order. Monte Carlo simulations show that the strong inter-layer spin exchange is essential for the high Neel temperature.