I think that it is related to the hormones involved, as about everything. Some people get constipated just before af. The hormones slow down digestion which can lead to stomach upset, more gas and constipation. Exercise can help this to some extent to speed up digestion. Maybe some extra fiber in your diet.
I get the worst gas pains and indigestion 2-3 days before I get AF and have had this as one of my pms since I was about 19. Insomnia is another pleasant pms that I get!