There is an algorithm to do this (and also to test two matrices in ${\rm GL}(n,{\mathbb Z})$ for conjugacy) described in the paper:
The conjugacy problem in ${\rm GL}(n,{\mathbb Z})$ Bettina Eick, Tommy Hofmann, E. A. O'Brien, Journal of the London Mathematical Society, Volume 100, Issue 3, December 2019 Pages 731-756.
It is implemented in Magma as the function $\mathtt {GLCentraliser}$.