The thing about Kepler’s third law that you’ve stated there, is that it only works for planets orbiting the sun. It actually follows rather logically from Newton’s law of gravity - F=GMm/r[sup]2[/sup] (equation 1).
Then, using Newton’s second law of motion, we know that:
F=ma (eqn 2), where a is the acceleration of the body on which the force is being applied, in this case, a planet orbiting the sun.
Now, a=rw[sup]2[/sup] = where w is the angular velocity of the object around the sun. (eqn 3)
So, F=mrw[sup]2[/sup]. (eqn 4)
w=1/P, where P is the rotational period of the planet. (eqn 5)
So, F=mr/P[sup]2[/sup] (eqn 6).
Equating equations 1 and 6 (which we can since the accelerating force is the gravitational force), we obtain:
r/P[sup]2[/sup]=GM/r[sup]2[/sup].
Doing some rearranging, we get:
r[sup]3[/sup]=GMP[sup]2[/sup], Kepler’s Third Law.
Newton also proved that Kepler’s Third Law will work for any two bodies orbiting a common centre of mass.
Also, bear in mind that the total energy in an orbit must remain constant. So, if you have a very eccentric orbit, when the planet is at its furthest away it will be moving slower than when its at its closest point, hence, two orbits with the same semi-major axes, but with different semi-minor axes can have the same orbital period.