We study how strain affects orbital ordering and magnetism at the interface between SrMnO$_3$ and LaMnO$_3$ from density-functional calculations and interpret the basic results in terms of a three-site Mn-O-Mn model. Magnetic interaction between the Mn atoms is governed by a competition between the antiferromagnetic superexchange of the Mn t$_{2g}$ core spins and the ferromagnetic double exchange of the itinerant e$_g$ electrons. While the core electrons are relatively unaffected by the strain, the orbital character of the itinerant electron is strongly affected, which in turn causes a large change in the strength of the ferromagnetic double exchange. The epitaxial strain produces the tetragonal distortion of the MnO$_6$ octahedron, splitting the Mn-e$_g$ states into x$^2$-y$^2$ and 3z$^2$-1 states, with the former being lower in energy, if the strain is tensile in the plane, and opposite if the strain is compressive. For the case of the tensile strain, the resulting higher occupancy of the x$^2$-y$^2$ orbital enhances the in-plane ferromagnetic double exchange owing to the larger electron hopping in the plane, causing at the same time a reduction of the out-of-plane double exchange. This reduction is large enough to be overcome by antiferromagnetic superexchange, which wins to produce a net antiferromagnetic interaction between the out-of-plane Mn atoms. For the case of the in-plane compressive strain, the reverse happens, viz., that the higher occupancy of the 3z$^2$-1 orbital results in the out-of-plane ferromagnetic interaction, while the in-plane magnetic interaction remains antiferromagnetic. Concrete density-functional results are presented for the (LaMnO$_3$)$_1$/(SrMnO$_3$)$_1$ and (LaMnO$_3$)$_1$/(SrMnO$_3$)$_3$ superlattices for various strain conditions.