Units still are not fully supported throughout - see changing display units for single elelements of a matrix or, as here some functions like rank.
In urgent need you may use the attached, which, when numerically evaluated gives the appropriate error message if the units don't fit and which can be used to get the correct result with symbolical eval. Unfortunately we can't put the latter in a single function as the intermediate numeric evaluation (matrix M2) is needed to get the units correctly simplified an cannot be achieved inside a program, AFAIK.