Using first-principles calculations based on density functional theory and projector augmented wave method, we investigate the thickness ratio dependences of the ionic relaxation, electronic structure, and magnetism of (LaMnO3)n/(SrTiO3)m heterostructure. Polar and nonpolar oxide interfaces have become a hot point of research in condensed matter physics; in this system, polar discontinuity at the interface may cause charge transfer to occur at interfaces between Mott and band insulating perovskites. Here, we consider two types of interfaces, namely n-type (LaO)+/(TiO2)0 and p-type (MnO2)-/(SrO)0 interfaces. The results show that the different thickness ratios and interface-types lead to different degrees of ionic relaxation, inducing charges of different concentrations to transfer. The distortions of the oxygen octahedra are found to vary distinctly with the component thickness ratio (n:m), which is consistent with recent experimental results. Furthermore, both n and m are found to strongly affect the charge transfer. When the thickness of LaMnO3 reaches a thickness of critical layers of 6 unit cells, the Mn-eg electrons are transferred to the Ti-dxy orbitals of SrTiO3, which is caused by the interface polar discontinuity. Two-dimensional electron gas with high mobility is formed in an n-type (LaMnO3)n/(SrTiO3)2 interface region. Meanwhile, spin polarization of interface-layer Ti atoms becomes more obvious, which induces Ti magnetic moment to be close to 0.05B. We find that Mn magnetic moment of 3.9B is a larger value at the n-type interface than at the p-type interface. The above studied heterostructure favours ferromagnetic spin ordering rather than the A-type antiferromagnetic spin ordering of bulk LaMnO3. Whether n-type or p-type (LaMnO3)2/(SrTiO3)8 interfaces consist of ultrathin LaMnO3 layer and thicker SrTiO3 layer, there is no structure distortion at the side of SrTiO3 basically, which is in agreement with experimental results. Stronger interface-layer polar distortions for p-type interface prevent the electron transfer from occurring, and spin polarization of Ti cannot occur either. In addition, it is found that the two types of interfaces possess 2 eV potential difference by comparing the average electrostatic potential, thus charge transfer is more difficult to occur in the p-type interface than in the n-type interface.