I want to compute the centralizer of $\mathfrak{so}_{n}(\mathbb{R})$ as a subalgebra of $\mathfrak{gl}_n(\mathbb{R})$:
$$ C_{\mathfrak{gl}_n}(\mathfrak{so}_{n}(\mathbb{R}))=\{X\in \mathfrak{gl}_{n}(\mathbb{R}),\ \forall S\in\mathfrak{so}_{n}(\mathbb{R})\ \ [X,S] = 0\} $$
My claim is that if $n\neq 2$ then,
$$ C_{\mathfrak{gl}_n}(\mathfrak{so}_{n}(\mathbb{R}))= \{\lambda Id_n,\ \lambda\in\mathbb{R}\} $$
and if $n=2$ then
$$ C_{\mathfrak{gl}_2}(\mathfrak{so}_{2}(\mathbb{R}))= \mathfrak{so}_{2}(\mathbb{R}) $$
more generaly how to compute the centralizer of $\mathfrak{so}_{p,q}(\mathbb{R})$ as a subalgebra of $\mathfrak{gl}_{p+q}(\mathbb{R})$ ?
Hint The usual matrix representation of $\mathfrak{so}_n$---the space of antisymmetric $n \times n$ matrices---is spanned by the matrices $$-E_{ij} + E_{ji}, \qquad i < j$$ where $E_{ij}$ is the matrix with $(i, j)$ entry $1$ and all other entries $0$, so it suffices find the intersections of the centralizers of all of these matrices.
So, suppose $X = (x_{ij}) \in C_{\mathfrak{gl}_2} (\mathfrak{so}_2)$ (herein I usually suppress the notation $(\Bbb R)$), so that $[X, -E_{ij} + E_{ji}] = 0$ for all $i < j$; write this matrix system in terms of its entries, and solve for the entries $x_{ij}$.
N.B. that the case $n = 2$ is exceptional: Here there is only one choice for $(i, j)$, namely $(1, 2)$, and the last condition hidden above is vacuous, leaving just the first two equations there. By relabeling entries we can write the centralizer of $\mathfrak{so}_2$ in $\mathfrak{gl}_2$ is $$C_{\mathfrak{gl}_2} (\mathfrak{so}_2) = \left\{\pmatrix{x&-y\\y&x} : x, y \in \Bbb R\right\} = \mathfrak{so}_2 \oplus \operatorname{span}\{\operatorname{Id}_2\} .$$
Remark Computing gives that this latter Lie algebra preserves the standard inner product up to a scalar multiple, so we sometimes call it the conformal (special) orthogonal Lie algebra and denote it $\mathfrak{cso}_2(\Bbb R)$.
The procedure for $\mathfrak{so}_{p, q}$ is essentially the same: (1) Pick a faithful matrix representation, (2) pick a convenient basis $(F_a)_{a \in A}$ of matrices, (3) impose the conditions $[X, F_a] = 0$, $a \in A$, on a general matrix $X \in \mathfrak{gl}_{p + q}$, and (4) write these equations in terms of their entires and solve.
It will require a few more observations, but probably one can handle all of the cases $\mathfrak{so}_{p, q}$ for a given $n := p + q$ simultaneously by computing $C_{\mathfrak{gl}_n(\Bbb C)}(\mathfrak{so}_n(\Bbb C))$ (the computation is essentially the same as for $\mathfrak{so}_n(\Bbb R))$.