Let M be an arbitrary o-minimal structure. Let G be a definably compact, definably connected, abelian definable group of dimension n. Here we compute: (i) the new intrinsic o-minimal fundamental group of G; (ii) for each k > 0, the k-torsion subgroups of G; (iii) the o-minimal cohomology algebra over Q of G. As a corollary we obtain a new uniform proof of Pillay's conjecture, an o-minimal analogue of Hilbert's fifth problem, relating definably compact groups to compact real Lie groups, extending the proof already known in o-minimal expansions of ordered fields.