Let $G$ be a Hausdorff locally compact group with identity component $G^0$, and assume $G / G^0$ is finite. The connected group $G^0$ has a maximal compact subgroup $K^0$, which is connected (Mathoverflow).
It is not hard to see that $K^0$ is contained in a maximal compact subgroup $K$ of $G$. This is simply because when $(g_i)$ are coset representatives for $G/G_0$, then there is no $g_i$ and distinct $g, h \in G^0/K^0$ for which $g_i g$ and $g_ih$ lie in a compact subgroup together with $K^0$, because otherwise $g^{-1}h$ would lie in a compact subgroup of $G^0$ strictly containing $K^0$. So by choosing $K$ containing the maximal number of $g_i g$, we find a maximal compact $K \subset G$ containing $K^0$ and with $|K/K^0| \leq |G/G^0|$.
Is $K$ unique?
This is just out of curiosity. In the case of Lie groups, this would make it convenient to speak of a unique maximal compact subgroup by referring only to its Lie algebra.
Observations:
- When $G$ is a Lie group, $K$ meets all components of $G$ (Hochschild, The structure of Lie groups, Chapter XV Theorem 3.1)
- $K^0$ is normal in $K$ and $K/K^0$ is naturally a subgroup of $G/G^0$.
There are plenty of counterexamples. This is more or less the same question as "do the elements of finite order form a subgroup".
A counterexample is the subgroup of $\operatorname{SL}_2(\mathbb R)$ consisting of diagonal and anti-diagonal matrices. Then $K_0 = 1$. The anti-diagonal elements are all of order $2$ and every one of them generates a maximal compact subgroup $K$.