When are $A,B \in M_{m,n}$ simultaneously unitarily equivalent to diagonal matrices? Let $A,B\in M_{m,n}$  . Show that $AB^*$ and $B^*A$ are both normal if and only if there are unitary matrices $X\in M_m$ and $Y\in M_n$ such that $A=X\Sigma Y^*$, $B=X\Lambda Y^*$, and $\Sigma,\Lambda\in M_{m,n}$ are diagonal. (Here $M_{m,n}$ denotes the set of $m\times n$ complex matrices and $A\in M_{m,n}$ diagonal means $A=[D \quad 0_{m\times(n-m)}]$ or $A=\begin{bmatrix} D \\ 0_{(m-n)\times n)} \end{bmatrix}$ with $D$ square diagonal).  Moreover, we can take $\Sigma$ to be the matrix of singular values from the SVD of $A$.
This is exerice $2.6.P3$ in Matrix Analysis by Horn & Johnson. I tried to follow the hints provided in the book, but  am not sure if I got all the details right:
For sufficiency we directly compute
$$AB^*=X\Sigma\Lambda^*X^*,\quad BA^*=X\Lambda\Sigma^*X^*, \quad B^*A=Y\Lambda^*\Sigma Y^*, \quad A^*B=Y\Sigma^*\Lambda Y^*,$$
and from here normality is verified using the fact that $\Sigma\Lambda^*$ and $\Lambda^* \Sigma$ are square diagonal, and hence commute with their conjugate transpose.
It remains to show necessity of the condition. So let $A,B \in M_{m,n}$ be such that $AB^*$ and $B^*A$ are both normal. WLOG we may assume $m\leq n$, for otherwise we can replace $A$ and $B$ by $A^*$ and $B^*$;  $AB^*$ and $B^*A$ are both normal if and only $A^*B$ and $BA^*$ are both normal, and $A,B$ are simultaneously unitarily equivalent to $\Sigma,\Lambda$ if and only if $A^*,B^*$ are simultaneously unitarily equivalent to $\Sigma^*,\Lambda^*$.
Let $A=U\Sigma V^*$ be an SVD decomposition for $A$. Making the substitutions $A\mapsto U^*AV=\Sigma$ and $B\mapsto U^*BV$, we check that the normality condition still holds, and that the simultaneous unitarily equivalence of $A,B$ after substitution implies the simultaneous unitarily equivalence of the original $A,B$ (by replacing $X$ with $UX$ and $Y$ with $VY$). Hence we can assume WLOG that $A=\Sigma$.
Next we will need the following Lemma, the proof of which can be found under Theorem 2.5.19 in the book of Horn & Johnson:
Lemma. let $A\in M_m$ and $B\in M_n$ be normal and let $X\in M_{m,n}$ be given. Then $AX=XB$ if and only if $A^*X=XB^*$.
Since $\Sigma B^*$ and $B^*\Sigma$ are both normal, and$(\Sigma B^*)\Sigma=\Sigma (B^*\Sigma)$, applying the previous lemma with $X=\Sigma$ gives
$$B\Sigma' \Sigma=\Sigma \Sigma' B \quad \quad (1)$$
Moreover, since $m\leq n$, we can write $\Sigma=[\Sigma_m\quad 0_{m\times (n-m)}]$, $\Sigma_m=s_1I_{n_1}\oplus\dots\oplus s_dI_{n_d}$, where $s_1>s_2>\dots>s_d\geq0$ are the distinct singular values of $A$.(The notation $A_{11}\oplus\dots \oplus A_{dd}$ denotes the block diagonal matrix having the square matrices $A_{11},\dots, A_{dd}$ on its diagonal). Note that $n_1+\dots+n_d=m$. Similarly we can write $B=[B_1\quad B_2]$ with $B_1\in M_m$ and $B_2\in M_{m\times (n-m)}$. Using these partitions we  check that  $(1)$ reduces to the following two conditions:
$$B_1\Sigma_m^2 = \Sigma_m^2 B_1  \quad \quad (2)$$
$$\Sigma_m^2B_2=0_{m\times(n-m)}\quad \quad (3)$$
We claim that $(2)$ implies that $B_1$ is block diagonal, with the same block structure as $\Sigma_m$. Indeed, if $i$ is a row in block $n_{k_i}$ and $j$ a column in block $n_{k_j}$, then
$$s^2_{n_{k_i}}[B_1]_{i,j}=[\Sigma_m^2 B_1]_{i,j}=[B_1\Sigma_m^2]_{i,j}=s^2_{n_{k_j}}[B_1]_{i,j}$$
and so $k_i\neq k_j$ implies $[B_1]_{i,j}=0$. Hence we can write  $B_1=B_{11}\oplus\dots \oplus B_{dd}$, with $B_{ii}\in M_{n_i}$ for each $1\leq i\leq d$.
Now, since $\Sigma B^*$ is normal, so is $B\Sigma^* =B\Sigma'=B_1\Sigma_m$. This means that
$$s_1^4 B_{11}B_{11}^*\oplus\dots\oplus s_d^4B_{dd}B_{dd}^*=B_1\Sigma_m^2B_1^*=\Sigma_m B_1^*B_1\Sigma_m=s_1^4 B^*_{11}B_{11}\oplus\dots\oplus s_d^4B_{dd}^*B_{dd} \quad \quad (4)$$
To finish the proof we distinguish between two cases:
Case $s_d>0$. Then from $(4)$ we see that $B_{ii}$ is normal, and so has a spectral decomposition $B_{ii}=U_iD_iU_i^*$ with $U_i\in M_{n_i}$ unitary and $D_i\in M_{n_i}$ diagonal, for each $i=1,\dots,d$. Moreover from $(3)$ we get that $B_2=0$. Let $X:= U_1\oplus\dots\oplus U_d$ and $D:=D_1\oplus\dots\oplus D_d$. Then $X\in M_{m}$ is unitary and $B_1=XDX^*$. Let $$W:=\left[ \begin{array} {c,c} U  \\ \quad \quad 0_{\small{(n-m)\times m}} \end{array} \right]$$
Then $W^*W=I_m$ and so we can extend the $m$ orthonormal columns of $W$ to obtain a unitary matrix $Y=[W \, Z]\in M_n$. Finally let $\Lambda:=[D \quad 0_{m\times(n-m)}]$. We check that
$$X\Lambda Y^*=[U D U^* \quad 0_{m\times(n-m)}]=B, \quad \quad X\Sigma Y^*=[U\Sigma_m U^*  \quad 0_{m\times(n-m)}]=\Sigma$$
as desired.
Case $s_d=0$. In this case we haved $n_d=m-r$, where $r$ denotes the rank of $A$, and we can write
\begin{equation} 
\Sigma_m=\left[ \begin{array} {c,c} \Sigma_r \quad \quad  \quad 0_{r\times(m-r)} \\ \quad 0_{(m-r)\times r} \quad 0_{(m-r)\times(m-r)} \end{array} \right] \quad \quad (5)
\end{equation}
with $\Sigma_r$ diagonal containing the $r$ nonzero singular values of $A$. From $(4)$ we see that $B_{ii}$ is normal, and so has a spectral decomposition $B_{ii}=U_iD_iU_i^*$ with $U_i\in M_{n_i}$ unitary and $D_i\in M_{n_i}$ diagonal, for each $i=1,\dots,d-1$. Moreover from $(3)$ and $(5)$ we get that
$$B_2:=\left[ \begin{array} {c,c} \quad \quad 0_{r\times(n-m)}  \\ \quad B_{22} \end{array} \right]$$
Let $QSR^*$ be an SVD decomposition for the matrix $[B_{dd}\quad B_{22}]\in M_{(m-r)\times(n-r)}$. Let $U:=U_1\oplus\dots\oplus U_{d-1}$ and
\begin{equation} 
X:=\left[ \begin{array} {c,c} \quad U   \quad 0_{r\times(m-r)} \\  \quad 0_{(m-r)\times r} \quad Q \end{array} \right] 
\end{equation}
\begin{equation} 
Y:=\left[ \begin{array} {c,c} \quad U   \quad 0_{r\times(n-r)} \\ \quad 0_{(n-r)\times r} \quad R \end{array} \right] 
\end{equation}
We check that $X$ and $Y$ are unitary. Let $D:=D_1\oplus\dots\oplus D_{d-1}$ and
\begin{equation} 
\Lambda:=\left[ \begin{array} {c,c} \quad D   \quad 0_{r\times(n-r)} \\  \quad 0_{(m-r)\times r} \quad S \end{array} \right] 
\end{equation}
We check that
\begin{equation} 
X\Lambda Y^*=\left[ \begin{array} {c,c} B_{11}\oplus\dots\oplus B_{(d-1)(d-1)}   \quad 0_{r\times(n-r)} \\  \quad 0_{(m-r)\times r} \quad \quad \quad \quad \quad[B_{dd}\quad B_{22}] \end{array} \right] =[B_1 \quad B_2]=B
\end{equation}
\begin{equation} 
X\Sigma Y^*=\left[ \begin{array} {c,c} U\Sigma_rU^*   \quad 0_{r\times(n-r)} \\  \quad 0_{(m-r)\times r} \quad  0_{(m-r)\times(n-r)} \end{array} \right] =\Sigma
\end{equation}
as desired.
Question: Under the additional assumption that $AB^*$ and $B^*A$ are both Hermitian, can we say that the elements of $\Lambda$ are real?
Thanks a lot for your help.
 A: Here's an attempt to adapt the proof given here to your case. Up to a unitary change of basis, we may assume that
$$
A = \pmatrix{S & 0\\0 & 0}, \quad B = \pmatrix{X & Y\\Z & W}
$$
where $S$ is square and diagonal with positive diagonal entries and $B$ is partitioned in the same way as $A$. We are given that the matrices
$$
AB^* = \pmatrix{SX^* & SZ^*\\0&0}, \quad B^*A = \pmatrix{X^*S & 0\\Y^*S & 0}
$$
are normal.

Claim: An $m \times m$ matrix
$$
\pmatrix{P & Q\\0 & 0}
$$
is only normal if $A$ is normal and $Q = 0$.

Proof of claim: If the matrix is normal, then
$$
0 = \pmatrix{P & Q\\0 & 0}\pmatrix{P & Q\\0 & 0}^* - \pmatrix{P & Q\\0 & 0}^*\pmatrix{P & Q\\0 & 0} = \\
\pmatrix{PP^* - P^*P + QQ^* & P^*Q\\Q^*P & -Q^*Q}.
$$
Looking at the bottom-right entry, we have $-QQ^* = 0 \implies Q = 0$. Looking at the top-left entry now yields $PP^* - P^*P = 0$, which is to say that $P$ is normal. $\square$.
With that, we conclude that $SX^*$ and $X^*S$ are normal, and $SZ^*,Y^*S$ are both zero. Because $S$ is invertible, we conclude that $Z = Y = 0$.
Claim: The fact that $SX^*$ and $X^*S$ are normal implies that $X = U \Sigma V^*$ and $S = U \Lambda V^*$ for some unitary $U,V$ (in other words, we have reduced the problem to the case where both matrices are square and one is positive definite).
I do not have a proof of this claim.
Proceeding from there, we have
$$
A = \pmatrix{S&0\\0&0}, \quad B = \pmatrix{X & 0\\0 & W},
$$
and so we can extend $U$ and $V$ to the required unitary matrices by finding an SVD of $W$.
