Traction alopecia occurs when repeated and excessive pressure is placed on the hair follicles, leading to hair loss. However, the role of hats in causing this condition is not conclusive.