Although what Hagen von Eitzen says is true, there is a much stronger restriction. The index of the center of a nonabelian group can never be a prime. So if the center is of index 2, then that group is actually abelian and so the center is actually the whole group.
Let's see why this is true.
Claim: The center $Z(G)$ of a group $G$ can never have index $p$ in $G$ for any prime $p$.
proof: As we so often do, suppose not; i.e. suppose we have a group $G$ with center $Z(G)$ of index $p$. Then $Z(G)$ is normal, so we can consider the quotient group $G/Z(G)$, which is a group of size $p$. Thus it is cyclic, say generated by an element $g$, and abelian.
In particular, this means that every element of $G$ can be written as $g^iz$ for some element $z$ in the center. So take two elements $a = g^iz_1$ and $b = g^jz_2$ in $G$, and consider their product.
$$ab = g_iz_1g^jz_2 = g^ig^jz_1z_2 = g^jg^iz_2z_1=g^jz_2g^iz_1 =ba$$
Where I used that the $g^i$ commute, and elements in the center commute with everything. Thus this shows that the group is abelian, contrary to the fact that the center was not the whole group. Contradiction. $\diamondsuit$
So the center cannot contain more than half the elements of the group, and in fact can't contain exactly half the elements of the group. But there is no reason why the index of the center couldn't be $6$ infinitely often, visibly by taking semidirect products of the symmetric group on 3 symbols with larger and larger abelian groups.
Let $G$ be any non-abelian group, and let $e$ be the identity of the group. For all $g\in G$, we have $$ge=eg=g,$$ so $C(e)=G$ is non-abelian.
Best Answer
If the group $G$ is abelian, then we would have that $Z(G) = G$. Normally in a group which is not necessarily abelian, there are elements which do not commute with every other element. What is true, is that $$Z(G) \unlhd G$$ As an example that in general $Z(G) \neq G$, we have that $$Z(S_n) = \{\operatorname{id}\}$$ whenever $n \geq 3$ (a proof can be found here).