Take the case that $a=2^{63}$, so k = 63. The loop will iterate k times. Under the assumption that a division takes $O(k^2)$, the total is $O(k^3)$. On the other hand, that is not the worst case. The worst case is a = 0, where the algorithm never terminates.
Using clever methods, multiplication and division for the general case can actually be performed a bit slower than $O (k \log k)$, which would be relevant if k is say a few hundred thousand. But if a is a binary number, then division by 2 can be performed in O(k), so the algorithm (if you check for a = 0 first) takes $O (k^2)$.
On the other hand, assuming binary representation, you can do this a lot faster by counting the number of trailing zero bits in O (k), then shifting the number by that many bits in O (k), with a total of O (k).