Assume $G$ is a connected locally compact group and $M$ is a maximal compact subgroup of $G$. Is $M$ connected too?

3$\begingroup$ Me too. To save someone else: $\operatorname{GL}_n(\mathbb{R})$ is not a counterexample because it is not connected! $\endgroup$ – Pete L. Clark Aug 28 '13 at 6:41

8$\begingroup$ For Lie groups, the LeviMalcev theorem says that every connected Lie group retracts to its maximal semisimple, and then it is well known that every semisimple retracts to its maximal compact. So every connected Lie group retracts to its maximal compact. This is useful in understanding the topology of a Lie group, and of its homogeneous spaces. $\endgroup$ – Ben McKay Aug 28 '13 at 7:07

1$\begingroup$ As a reference, look at numdam.org/numdambin/fitem?id=SB_19481951__1__271_0 $\endgroup$ – Ben McKay Aug 28 '13 at 7:09

2$\begingroup$ @BenMcKay are you assuming G is simply connected when you use LeviMalcev? $\endgroup$ – Yemon Choi Aug 28 '13 at 7:28

1$\begingroup$ @BenMcKay: Isn't it true that $G/K$ ($K$ maximal compact) is always homeomorphic (diffeomorphic) to $\mathbb{R}^n$ for some $n$? So it should be always contractible. $\endgroup$ – user23860 Aug 28 '13 at 8:08
Disclaimer: Locally compact groups are absolutely not my field of expertise. I hope an expert can check my statements below, and perhaps add some details and references.
The Malcev–Iwasawa theorem implies that any connected, locally compact group $G$ satisfies:
$G$ has a maximal compact subgroup;
there exists $n\in\mathbb{N}$ such that for any maximal compact subgroup $K$ of $G$, the underlying space of $G$ is homeomorphic to $K\times\mathbb{R}^n$.
In particular, every maximal compact subgroup of a connected, locally compact group is itself connected.
References: The following references state the necessary results without proof.
Theorem 32.5 of Markus Stroppel's book "Locally compact groups".
The article "Compact subgroups of Lie groups and locally compact groups" (DOI: http://dx.doi.org/10.1090/S00029939199411663579), published in the Proceedings of the American Mathematical Society, volume 120, number 2, in February 1994 (pages 623634). See the statements of theorems A, B, and C in the introduction to this article. According to the discussion there, the theorems hold for connected, locally compact groups: they follow from the analogous results for Lie groups as soon as one knows that a connected, locally compact group is a projective limit of Lie groups.