On experimental side, BaFe$_2$As$_2$ without doping has been made superconducting by applying appropriate pressure (2-6 GPa). Here, we use a full-potential linearized augmented plane wave method within the density-functional theory to investigate the effect of pressure on its crystal structure, magnetic order, and electronic structure. Our calculations show that the striped antiferromagnetic order observed in experiment is stable against pressure up to 13 GPa. Calculated antiferromagnetic lattice parameters are in good agreements with experimental data, while calculations with nonmagnetic state underestimate Fe-As bond length and c-axis lattice constant. The effects of pressure on crystal structure and electronic structure are investigated for both the antiferromagnetic state and the nonmagnetic one. We find that the compressibility of the antiferromagnetic state is quite isotropic up to about 6.4 GPa. With increasing pressure, the FeAs$_4$ tetrahedra is hardly distorted. We observe a transition of Fermi surface topology in the striped antiferromagnetic state when the compression of volume is beyond 8% (or pressure 6 GPa), which corresponds to a large change of $c/a$ ratio. These first-principles results should be useful to understanding the antiferromagnetism and electronic states in the FeAs-based materials, and may have some useful implications to the superconductivity.