In the case of rectangular slab, the light ray undergoes refraction two times at opposite faces.
At first refracting face, the light rays enters glass from air so that it bends towards the normal, whereas at the second refracting face, the light ray bends away from the normal where it enters air from glass.
As the light ray undergoes refraction two times in opposite directions, the emergent ray is parallel to the incident ray.