Take $X=Y=E_{1,1}$ (the matrix unit). Then $XAY=x_{1,1}E_{1,1}$, a diagonal matrix. If $R$ does not have 1, take $X=Y=aE_{1,1}$ for any $a\ne 0\in R$. Then $XAY=ax_{1,1}aE_{1,1}$ (it may be a zero matrix, but zero matrix is diagonal).
Update. Since you now want to find invertible $X,Y$, I would recommend starting with $2\times 2$-matrices and reading the book by Cohn, "Free rings and their relations", especially Chapter 2, Section 2.6.
Take $X=Y=E_{1,1}$ (the matrix unit). Then $XAY=x_{1,1}E_{1,1}$, a diagonal matrix. If $R$ does not have 1, take $X=Y=aE_{1,1}$ for any $a\ne 0\in R$. Then $XAY=ax_{1,1}}aE_{1,1}$ XAY=ax_{1,1}aE_{1,1}$(it may be a zero matrix, but zero matrix is diagonal). 2 added 147 characters in body; added 5 characters in body Take$X=Y=E_{1,1}$(the matrix unit). Then$YAY=x_{1,1}E_{1,1}$, XAY=x_{1,1}E_{1,1}$, a diagonal matrix. If $R$ does not have 1, take $X=Y=aE_{1,1}$ for any $a\ne 0\in R$. Then $XAY=ax_{1,1}}aE_{1,1}$ (it may be a zero matrix, but zero matrix is diagonal).