The original way of making barrels was to wrap strips of iron around a mandrel in spiral fashion, sometimes twisting the straps in doing so. this spiral wound tube wass then welded into a solid iron tube (Damascus barrel). This rough tube was then filed into hexagon shape. It remained the mark of quality. And, the hexagon shape added weight out front, in a muzzle-heavy rifle that held steady for off-hand shooting.
As the use of lathes came into use, round, or tapered barrels came into vogue. The lighter weight was appreciated by the horse soldier and horse.
Today, its pretty much ornamental, much like case hardened coloring.