Barrels don't get hardened, but may get a heat treatment. They are soft. If they were not, they would be a right stone b**ch to thread and chamber so they would fit on an action. Since the making of a barrel requires, at the least, that one be able to drill and ream a clean accurate, straight hole, for a very long distance, machineability is a very high priority, when selecting a material.
Heat treating, may include hardening and tempering, or it may be for releiving the stresses built up in the barrel stock while it was manufactured, or machined to profile.
It's a LARGE subject. Different materials, and different alloys of the same materials, behave very differently to applications of heat treatment, and a through knowlege of both the material, and the required results, are a requirement.
Case hardening, or carbuerizing, full through hardening, and induction heating for selective hardening of small areas may be used, depending on the application. Then you have powder metallurgy, and a few other little twists to deal with along the way...
Cheers
Trev