To keep the pressure equalized. If you have a pen with no hole, and were to take it up in an airplane, or even to the top of a building, the pressure difference could cause the ink to flow out of the pen creating a mess and making writing really messy.

There is a hole in the body of the Compressed polystyrene to equalise atmospheric pressure, for the reasons stated above, however the hole in the top of the lid is to prevent children for sucking the lid into their throat, subsequently this provides an air passage in such a case.