Agree with Rajdeep. We need to know where the poles are located.
Let the edge of the cube = a.
Assumption 1: If the poles are located at the center of the two opposite planes of the cube, then shortest distance between them is simply the edge of the cube.
Shortest distance = a
Assumption 2: If the poles are located at the two opposite corners of the cube, then we can find the distance between them by appyling pythagorus theorem twice.
Shortest distance = sqr-root(3) * a = 1.73205 * a
Now assumptions 1 and 2 calculate the shortest distance, and not shortest route (Dharti me badh ke jaoge toh assumptions 1 and 2 padho, arr dharti pe chaal ke jaaoge toh aagli assumptions 3 arr 4 padho

)
Assumption 3: If the poles are located at the center of the two opposite planes of the cube, then shortest distance between them is twice the edge of the cube.
Shortest distance = 2a
Assumption 4: If the poles are located at the two opposite corners of the cube, then we can find the distance between them by appyling pythagorus theorem twice.
Shortest distance = sqr-root(5) * a = 2.236068 * a.