It is possible they like the noise. Perhaps they do it for attention. Stalled horses typically develop the habit, but a horse may crib on a pasture fence if the pasture is not good. Then alter the horse's environment to make cribbing inconvenient and to provide alternative entertainment. Horses have a difficult time cribbing on objects below knee level, so things like feed bunks can be lowered.
Metal strips on stall doors and electrical fencing can help prevent damage to wood.
Some horses enjoy rattling a plastic container with gravel hung in their stall. Some horses enjoy big beach balls in their pasture. Sometimes a buddy, such as a kitten or goat, will keep a horse content. Adding more hay to the diet keeps a horse busy eating. Hardworking horses don't have much interest in cribbing.