  By ab initio many-body quantum chemistry calculations, we determine the
strength of the symmetric anisotropy in the 5$d^5$ j $\approx$ 1/2 layered
material Ba$_2$IrO$_4$. While the calculated anisotropic couplings come out in
the range of a few meV, orders of magnitude stronger than in analogous 3d
transition-metal compounds, the Heisenberg superexchange still defines the
largest energy scale. The ab initio results reveal that individual layers of
Ba$_2$IrO$_4$ provide a close realization of the quantum spin-1/2
Heisenberg-compass model on the square lattice. We show that the experimentally
observed basal-plane antiferromagnetism can be accounted for by including
additional interlayer interactions and the associated order-by-disorder
quantum-mechanical effects, in analogy to undoped layered cuprates.
