Prior to about the 1880's there was no way to drill a straight hole in a bar of steel. There were several ways to get around this.
One was to use a mandrel, which was an iron rod of less than bore diameter and wrap strips of red hot iron or steel (or mixed) around the mandrel, welding them as you went. This is how so-called "Damascus" barrels were made.
Another method was to heat a flat bar of steel and bend it lengthwise around the mandrel, welding the edges when they met. This is how many Civil War musket barrels were made.
The third way was to drill a hole in a short thick bar, then heat it, insert the mandrel, and draw it out in rollers until it was close to the right diameter. No matter how they were made, the barrels were then turned on a lathe or ground, reamed to the correct bore diameters, and the rifling cut.
Rifling was cut by the "scrape method" in which a cutter was drawn through the barrel to make a shallow cut. The cutter bar was attached to a guide, with spiral cuts in it which guided the cutter. One shallow cut was made, the cutter rotated, the next shallow cut, and so on until all the rifling was cut, but shallow. Then the cutter head was shimmed to cut a little deeper, and the process repeated until the grooves were of the desired depth.
Modern rifling is usually cut by either button rifling, in which a carbide plug with the rifling in reverse is forced through a barrel by compressed fluid (air or hydraulic), or by hammer forging, in which a mandrel with rifling in reverse is inserted in the barrel and the barrel hammered (cold forged) around it until the rifling is impressed into the barrel. This produces a series of spiral hammer marks on the outside of the barrel, which most makers grind off, but which some leave as a trademark and a unique appearing finish.
Jim