Undertrays are largely an air flow management device, getting cooling air through the rad pack and engine bay while minimising drag etc.
I dare say there are other aspects regarding noise, water ingress etc., I've never been involved in bodywork development, only powertrain.