You can formulate this problem as an orthogonal Procustes problem: $$ \min_{X \text{ orthogonal}} \|AX-B\|_F. $$
Converting from the notation in the Wikipedia page to this form, the solution is $X=UV^T$, where $A^TB = U\Sigma V^T$ is an SVD; a proof follows from manipulating the expression using the Frobenius (trace) inner product.