Why why have a pupil at all? Surely it would always be helpful to let as much light in as possible? After all, we know if we don't have enough light, we can't see - this is what happens in the dark.
No, not really. The trick is to consider the sensitivity of the light-reactive retinal cells (the well-named photoreceptors). For any receptor there is an intensity of the stimulus that it will respond best to, and the photoreceptors are no exception. If less light than this is shone, the image will be too dark. And if the light shone is less than the lower limit of its sensitivity, it won't register it at all - for all intents and purposes it would be as if there were no light.
What if we move to the other extreme and shine light of such an intensity that it exceeds the optimal level for our photoreceptors? Again, we lose image clarity - too many photoreceptors are excited, and the image starts to resemble a 'whiteout'. You can get a glimpse of this when looking at a photo that has been 'overexposed'. Here the effect is similar.
In summary: we need a fairly constant level of light intensity to best form useful images with our eyes. And this is the main function of the pupillary light reflex that the question refers to. Too little light (for our photoreceptors), and the pupil dilates, letting more light in. Too much light and the pupil constricts, diminishing the quantity of photons hitting the retina.
(Postscript: there at least one more vital function, and it has to do with image sharpness. Can anyone guess?)