Glock was one of the first handgun manufacturers to offer factory-made ported/compensated autopistols. Although there are differences between installing a compensator on a handgun, and porting the barrel/slide assembly, Glock seems to use the terms almost interchangeably, and so will I.
The purpose of a ported or compensated handgun is to reduce the recoil-related upward flip of the barrel when it is fired, thereby getting the sights back on target (or onto the next target) as quickly as possible. Porting can be done in different ways, and Glock has used several different methods on various models over the years.
The first ported Glock was the model 17L. Early versions had a barrel ported with three angled slots, to direct some of the powder gasses upward, reducing the muzzle flip when fired. Not all 17L models were ported; some had conventional (non-ported) barrels. Although Glock has never officially acknowledged a problem with the 17L ported barrels, there were reports from some users that the thin area between the ports would sometimes crack. All Gen2 and Gen3 versions of the 17L were only sold with non-ported barrels, which could be interpreted as a confirmation that there was some kind of difficulty with the earlier Gen1 17L ported barrels.
Early Gen1 G17L with ported barrel:
Side view of barrel (removed from slide) to show profile of the ports: