6 added 7 characters in body

Another argument which does it:

A path connected based space $X$ is a co-$H$ space if and only if the evaluation map $\Sigma \Omega X \to X$ admits a section up to homotopy. This will imply that $\pi_1(X)$ is a retract of $\pi_1(\Sigma \Omega X)$, and it's easy to see that the latter has a free fundamental group (generated by elements of $\pi_1(X)$). Now use the fact that a subgroup of a free group is free.

The rest of the argument goes as Jeff says: the fundamental group of an $H$-space is abelian.

If in addition we assume all spaces $X$ appearing above have the homotopy type of a finite complex, then we can actually give a complete classification.

First of all, the existence of an $H$-space structure implies that $X$ satisfies Poincare duality (this is well-known and can be deduced from the structure theorem for connected Hopf algebras; I also gave an independent proof in one of my papers--I can't remember which one).

Secondly, since $X$ is also co-$H$, there are no non-trivial cup products of classes in positive degrees.

If we combine these two statements (duality + no cup products) we infer that $X$ has cohomology concentrated in degrees $0$ and some integer $n$. If $X$ isn't a contractible, it follows from duality that $n > 0$ and $H_n(X) = \Bbb Z$. It follows that $X$ is a cohomology $n$-sphere.

Since $X$ is an $H$-space it is a simple space, so $X$ is then a homotopy $n$-sphere (proof: if $n = 1$ represent the generator of $\pi_1$ by a map $S^1 \to X$, this will be a homology isomorphism and then apply the Whitehead theorem. If $n > 1$ use the fact that $X$ must be simply connected and then use the Hurewicz theorem to represent the generator of $H_n(X)$ by a map $S^n \to X$ and argue as in the $n=1$ case).

Now, it is well known (using say, Hopf invariant one) that the $n$-sphere is an $H$-space iff $n = 0, 1,3,7$, so we've shown:

Theorem: If $X$ is both an $H$-space and a co-$H$ space and has the homotopy type of a connected finite CW complex, then $X$ has the homotopy type of a point or an $n$-sphere, where $n$ = 1,3,7.

5 added 18 characters in body

Another argument which does it:

A path connected based space $X$ is a co-$H$ space if and only if the evaluation map $\Sigma \Omega X \to X$ admits a section up to homotopy. This will imply that $\pi_1(X)$ is a retract of $\pi_1(\Sigma \Omega X)$, and it's easy to see that the latter has a free fundamental group (generated by elements of $\pi_1(X)$). Now use the fact that a subgroup of a free group is free.

The rest of the argument goes as Jeff says: the fundamental group of an $H$-space is abelian.

If in addition $X$ has we assume all spaces above have the homotopy type of a finite complex, then we can actually classify the spaces of the questiongive a complete classification.

First of all, the existence of an $H$-space structure implies that $X$ satisfies Poincare duality (this is well-known and can be deduced from the structure theorem for connected Hopf algebras; I also gave an independent proof in one of my papers--I can't remember which one).

Secondly, since $X$ is also co-$H$, there are no non-trivial cup products of classes in positive degrees.

If we combine these two statements (duality + no cup products) we infer that $X$ has cohomology concentrated in degrees $0$ and some integer $n$. If $X$ isn't a contractible, it follows from duality that $n > 0$ and $H_n(X) = \Bbb Z$. It follows that $X$ is a cohomology $n$-sphere.

Since $X$ is an $H$-space it is a simple space, so $X$ is then a homotopy $n$-sphere (proof: if $n = 1$ represent the generator of $\pi_1$ by a map $S^1 \to X$, this will be a homology isomorphism and then apply the Whitehead theorem. If $n > 1$ use the fact that $X$ must be simply connected and then use the Hurewicz theorem to represent the generator of $H_n(X)$ by a map $S^n \to X$ and argue as in the $n=1$ case).

Now, it is well known (using say, Hopf invariant one) that the $n$-sphere is an $H$-space iff $n = 0, 1,3,7$, so we've shown:

Theorem: If $X$ is both an $H$-space and a co-$H$ space and has the homotopy type of a connected finite CW complex, then $X$ has the homotopy type of a point or an $n$-sphere, where $n$ = 1,3,7.

4 added 2 characters in body

Another argument which does it:

A path connected based space $X$ is a co-$H$ space if and only if the evaluation map $\Sigma \Omega X \to X$ admits a section up to homotopy. This will imply that $\pi_1(X)$ is a retract of $\pi_1(\Sigma \Omega X)$, and it's easy to see that the latter has a free fundamental group (generated by elements of $\pi_1(X)$). Now use the fact that a subgroup of a free group is free.

The rest of the argument goes as Jeff says: the fundamental group of an $H$-space is abelian.

If in addition $X$ has the homotopy type of a finite complex, then we can actually classify the spaces of the question.

First of all, the existence of an $H$-space structure implies that $X$ satisfies Poincare duality (this is well-known and can be deduced from the structure theorem for connected Hopf algebras; I also gave an independent proof in one of my papers--I can't remember which one).

Secondly, since $X$ is also co-$H$, there are no non-trivial cup products of classes in positive degrees.

If we combine these two statements (duality + no cup products) we infer that $X$ has cohomology concentrated in degrees $0$ and some integer $n$. If $X$ isn't a contractible, it follows from duality that $n > 0$ and $H_n(X) = \Bbb Z$. It follows that $X$ is a cohomology $n$-sphere.

Since $X$ is an $H$-space it is a simple space, so $X$ is then a homotopy $n$-sphere (proof: if $n = 1$ represent the generator of $\pi_1$ by a map $S^1 \to X$, this will be a homology isomorphism and then apply the Whitehead theorem. If $n > 1$ use the fact that $X$ must be simply connected and then use the Hurewicz theorem to represent the generator of $H_n(X)$ by a map $S^n \to X$ and argue as in the $n=1$ case).

Now, it is well known (using say, Hopf invariant one) that the $n$-sphere is an $H$-space iff $n = 0, 1,3,7$, so we've shown:

Theorem: If $X$ is both an $H$-space and a co-$H$ space and has the homotopy type of a connected finite CW complex, then $X$ has the homotopy type of a point or an $n$-sphere, where $n$ = 1,3,7.