Ab initio techniques have been used to investigate structural changes in semiconducting Mg2Si and Ca2Si thin films (from 17 nm down to 0.2 nm corresponding to the 2D structure) along with band-gap variations due to quantum confinement. Cubic Mg2Si(111) thin films being dynamically stable at thicknesses (d) larger than 0.3 nm displayed an indirect band gap, the reduction of which with increasing d could be reasonably well described by the simple effective mass approximation. Only 2D Mg2Si has a unique structure because of the orthorhombic distortion and the direct band gap. Since the surface energy of cubic Ca2Si(111) films was lower with respect to any surface of the orthorhombic phase, which is the ground state for the Ca2Si bulk, the metastable in-bulk cubic phase in the form of thin films turned out to be preferable in total energy than any orthorhombic Ca2Si thin film for d < 3 nm. Sizable structural distortion and the appearance of surface states in the gap region of Ca2Si thin films with d < 3 nm could be the reason for an odd dependence of the band-gap variation on d.