We have studied the electronic and magnetic structures of the ternary iron arsenides AFe$_2$As$_2$ (A = Ba, Ca, or Sr) using the first-principles density functional theory. The ground states of these compounds are in a collinear antiferromagnetic order, resulting from the interplay between the nearest and the next-nearest neighbor superexchange antiferromagnetic interactions bridged by As $4p$ orbitals. The correction from the spin-orbit interaction to the band structure is small. The pressure can reduce dramatically the magnetic moment and diminish the collinear antiferromagnetic order. Based on the calculations, we propose that the low energy dynamics of these materials is described effectively by a $t-J_H-J_1-J_2$-type model.