This is not the only instance of a Trainer's Pokemon being underlevelled. Other examples include Lance's infamous Dragonites, and Ghetsis' Hydreigon, along with many, many random Bug Catchers throughout the series. The reason behind this is that otherwise, they would be too powerful. Fighting a Level 48 Haxorus (that's when Fraxure evolves) for that Gym battle is way too difficult, as you would likely be underlevelled.
It's important to maintain difficulty and fairness in the game. If Iris had a Fraxure, she would be too weak, and not different enough from the Gym Trainers. If she had a Level 48 Haxorus, she would be too strong, and cause a great deal of frustration for players.
Hope I helped!