Bit like asking how long is a piece of string. Between 6 and 12 feet depending what type of fence. As 7mm equals a foot I'll leave you to do the multiplication.
You asked for the distance in mm. So as 7mm equals a foot in O gauge, posts 8ft apart would be 7x8 = 56mm etc.