This is called "venting the roof." There are two basic reasons for this practice.
Visibility & Breathable Air
Dangerous gases and dark smoke accumulate in a burning building. Unlike the movie versions of fires, it is impossible for firefighters to see in such an environment.
When a hole is made in the roof, the smoke and gases escape because heat and smoke rise which makes it much easier for the firefighters in the building to see. It also reduces the possibilities of backdraft and flashover.
Fire Progress Assessment
Another reason for venting the roof is to see how far the fire has progressed. One of the fastest avenues through which fires spread is the attic.
Heat and smoke rise into the attic where the fire can move quickly. Firefighters may go ahead of the fire on a roof, cut holes to access the attic and stop the fire from spreading through the attic.