It's called cribbing/ windsucking. Horses do that when they are board, mad or sick. Ya need to find out which one is causing them to do that. If they keep chewing on the posts or anything other than food, it can damage their teeth or they can swallow a foreign object(s), wood splinters, metal nails or screws, and it can really make them sick or hurt their digestive system.
Those opposed to it, say neigh.