Exact solutions of the Einstein equations for an infinite slab with a constant energy density