$SO(n)$ is not only maximal compact in $SL_n(\mathbb{R})$, it is even a maximal subgroup! Same for $SU(n)$ in $SL_n(\mathbb{C})$. This follows e.g. from Exercise A.3 in Chapter VI in S. Helgason, ``Differential geometry, Lie groups and symmetric spaces'', Academic Press, 1978. From this the normalizers of $O(n)$ in $GL_n(\mathbb{R})$, and of $U(n)$ in $GL_n(\mathbb{C})$, are easily determined.

To establish maximality of $K=SL_n(\mathbb{Z}_p)$ as a subgroup of $G=SL_n(\mathbb{Q}_p)$, there is a cute argument using the Howe-Moore theorem, telling you that, if $\pi$ is a unitary representation of $G$ without non-zero fixed vectors, then all coefficients of $\pi$ go to $0$ at infinity on $G$. So assume that $U$ is a proper subgroup of $G$, containing $K$. Since $K$ is open, $U$ is open too. By simplicity of $G$, the subgroup $U$ cannot have finite index. Let $\pi$ be the quasi-regular representation of $G$ on $\ell^2(G/U)$, it has no non-zero fixed vector; let $\delta_U\in\ell^2(G/U)$ be the characteristic function of the base-point of $G/U$, corresponding to the trivial coset of $U$. Then the coefficient $g\mapsto<\pi(g)\delta_U|\delta_U>$ is constant and equal to 1 on $U$, so by Howe-Moore $U$ must be compact. Since $K$ is maximal compact, we have $U=K$.
From this you also deduce the normalizer of $GL_n(\mathbb{Z}_p)$ in $GL_n(\mathbb{Q}_p)$.

Ref: R.E. Howe and C.C. Moore. Asymptotic properties of unitary representations. J. Funct. Anal. 32, 72-96, 1979.

EDIT: For the maximality of $SO(n)$ in $SL_n(\mathbb{R})$, the strategy of the proof is nicely explained in http://www.math.jussieu.fr/%7Eginot/GL/TD3-GL2009.pdf