We assume $n=2$ and we consider $A,B\in SL_2(\mathbb{R})$ s.t. $A,B$ are not simultaneously triangularizable (that is $\det(AB-BA)\not= 0$). Let $C,D\in SL_2(\mathbb{Z})$ s.t. $(A,B)$ and $(C,D)$ are in the same class of simultaneous similarity. By a result due to Friedland, such a class modulo $GL_n(\mathbb{C})$ depends only on the values of $tr(A),tr(A^2),tr(B),tr(B^2),tr(AB)$. Here $\det(A)=\det(B)=1$; then, as wrote Andreas, it suffices to know $tr(A),tr(B),tr(AB)$.
Thus a necessary condition for the existence of $(C,D)$ is
$(*)$ $tr(A),tr(B),tr(AB)\in\mathbb{Z}$.
Conversely, under the above conditions $(*)$, assume that there are $C,D\in SL_2(\mathbb{Z})$ satisfying $tr(A)=tr(C),tr(B)=tr(D),tr(AB)=tr(CD)$. There is $P\in GL_2(\mathbb{C})$ s.t. $P^{-1}AP,P^{-1}BP\in SL_2(\mathbb{Z})$; clearly, we can choose $P\in GL_2(\mathbb{R})$ and even $P$ s.t. $\det(P)=\pm 1$. If $P=\begin{pmatrix}a&b\\c&d\end{pmatrix}$ then let $Q=\begin{pmatrix}-a&b\\-c&d\end{pmatrix}$; then $\det(Q)-\det(P)$ and $Q^{-1}AQ,Q^{-1}BQ\in SL_2(\mathbb{Z})$. Finally we can choose $P\in SL_2(\mathbb{R})$.
The question is whether $C, D$ always exist.
Let $a,b,c\in\mathbb{Z}$. We can always find $A,B\in SL_2(\mathbb{C})$ s.t. $tr(A)=a,tr(B)=b,tr(AB)=c$ but it's false in $SL_2(\mathbb{Z})$.
Let $U=\{(a,b,c)\in\mathbb{Z}^3;$ there are $C,D\in SL_2(\mathbb{Z})$ not simultaneously triangularizable and s.t. $tr(C)=a,tr(D)=b,tr(CD)=c\}$.
$\textbf{Proposition}$. $U$ has density $0$ in $\mathbb{Z}^3$.
$\textbf{Proof}$. Since $C$ is not a scalar matrix, we may assume that $C=\begin{pmatrix}0&-1\\1&a\end{pmatrix},B=\begin{pmatrix}p&q\\r&b-p\end{pmatrix}$ and the conditions are
$p(b-p)-qr=1,-r+q+a(b-p)=c$.
It is a system of $2$ equations in the unknowns $p,q$ (considering $r$ as a parameter). A necessary condition for the existence of integer solutions is
There is $r\in\mathbb{Z}$ s.t. $(ar-b)^2-4(-abr+cr+r^2+1)$ is a square.
that is, there is $r\in\mathbb{Z}$ s.t. $(a^2-4)r^2+(2ab-4c)r+b^2-4$ is a square. Note that the coefficients of $r^2 ,r,1$ are independent. $\square$
It remains to study the case when $A,B$ are simultaneously triangularizable.