The surfaces of a flat slab are parallel, so any refraction that takes place upon entering the slab is reversed upon leaving. Not so for the prism, the sides of which are at an angle.
When light enters the first surface of prism or a slab at an angle, the various frequencies refract at different angles. But since both surfaces of the slab are parallel, the refraction is reversed when the light leaves the slab: The various frequencies, while displaced a bit, leave the slab parallel. Not so for the prism: The different colors leave the prism at different angles, making it easy to see the dispersion.