A criterion is presented that characterizes when two matrix polynomials of any size, rank and degree have the same finite and infinite elementary divisors. This characterization inherits a coprimeness condition of the extended unimodular equivalence defined by Pugh and Shelton [17] in the set of real or complex matrix polynomials satisfying the constraint that the difference between the number of rows and columns is constant. This extended unimodular equivalence is first generalized to matrices of any size with elements in any principal ideal domain.