Let $\omega_d(G)$ be the number of elements of order d in the finite group G. Let X be the collection of all finite groups G such that for every d, $\omega_d(H) = \omega_d(G) \mod |H|$ for every subgroup H ≤ G.
As jspecter's remarks, X is clearly closed under subgroups, so we may be interested in minimal non-X-groups, those groups which are not in X but every proper subgroup is in X.
Lemma: The cyclic group of order pq for distinct primes p, q is a minimal non-X-group.
Proof: It has p−1 elements of order p, but it cannot be the case that both p−1≡0 mod q and q−1≡0 mod p. $\square$
Lemma: A finite group with both a cyclic subgroup and an elementary abelian subgroup, both of order $p^2$, cannot be an X-group.
Proof: The number of elements of order p in the whole group must be equal to $p^2-1 \mod p^2$ due to the elementary abelian subgroup, but it must also be equal to $p-1 \mod p^2$ due to the cyclic subgroup. $\square$
Proposition: A finite abelian group is an X-group if and only if it is a cyclic p-group or an elementary abelian p-group for some prime p.
Proof: If the group is not a p-group, then the first lemma applies. If the group is not of exponent p, then it must be cyclic by the second lemma. $\square$
Proposition: A finite 2-group is an X-group if and only if it is cyclic, elementary abelian, or the quaternion group of order 8.
Proof: If the group has exponent 2, then it is elementary abelian. Otherwise it contains an element of order 4. By the second lemma it contains no elementary abelian subgroups of rank 2, and so it must be cyclic or generalized quaternion. However the generalized quaternion group of order 16 is a minimal non-X-group, and so the only possibility is Q8 which is easily checked to be an X-group, have 6 elements of order 4, which is 2 mod 4 and 0 mod 2. $\square$
The p-groups for odd p will defy such an explicit classification, since all groups of exponent p are X-groups. However, this is the only obstacle:
Proposition: A p-group for odd p is an X-group if and only if it is cyclic or of exponent p.
Proof: Again, unless it is exponent p it cannot have any elementary abelian subgroups of rank 2. In the odd p case, this leaves only the cyclic groups as candidates. $\square$.
Proposition: A nilpotent group is an X-group if and only if it is a cyclic p-group, a group of exponent p, or the quaternion group Q8.
Proof: A nilpotent X-group must be a p-group lest it contain a cyclic subgroup of order pq. $\square$
I will leave solvable groups open for now, but remark with jspecter that non-abelian groups of order pq and more generally cyclic groups of order $p^n$ acting faithfully and irreducibly on groups of order $q^m$ are X-groups, as they have $(p^d-p^{d-1})q^m$ elements of order $p^d$ which is 0 mod $q^m$ as it should be, and since $1 \equiv q^m \mod p^n$ in order for the action to exist, it is even equal to $p^d - p^{d-1}$ mod $p^d$ as it should be. Similarly, $q^m-1$ is equal to 0 mod $p^n$ and $q^d-1$ mod $q^d$, all as it should be.
Proposition: A finite non-abelian simple group is an X-group if and only if it is PSL(2,4) or PSL(2,8).
Proof: We have several convenient hypotheses available: the Sylow 2-subgroups are elementary abelian (cyclic and quaternion being ruled out by Glauberman's Z*-theorem), and so the group is either a $\operatorname{PSL}(2,2^n)$ or J1. Explicit calculation rules out J1, and confirms PSL(2,4) and PSL(2,8). For general $2^n$, our group contains cyclic groups of order $2^n+1$ and $2^n-1$, both of which must be prime powers. I believe the only solutions to this are $2^2\pm1=3,5$ and $2^3\pm1=7,9$, but I am not sure if this a well-known fact or an open problem in elementary number theory.
This can be extended to all almost simple groups by observing that S5 and PΓL(2,8) are not X-groups. The direct product of almost simple groups is never an X-group, since it contains a cyclic subgroup of order $2p$.
My interpretation of the question is "Do there exist non-isomorphic non-abelian groups $G$ and $H$ such that $|G|=|H|$ and they have the same number of elements of the same order". This is not the classification question, but I suspect this is the question the OP wants to know the answer to (and is asked in the last line).
Note that, as leo points out in the comments, the abelian case is covered elsewhere.
The solution to the non-abelian case is, perhaps, quite easy. As the OP points out, there exist abelian and non-abelian groups which have the same number of elements of any order, call them $A$ and $B$. So $A$ is abelian, $B$ is non-abelian, $|A|=|B|$ and we have the condition on the order of elements. The idea is simply to take $G=A\times B$ and $H=B\times B$.
However, cross-produts can introduce elements of new orders (for example, $\mathbb{Z}_2\times\mathbb{Z}_3\cong\mathbb{Z}_6$), so we have to be careful. I am not saying that the above construction doesn't always work, but rather you would have to prove that it always works. In order to get round this proof, take $B$ to be the following group.
$$B=\langle x,y,z; x^3 = y^3 = z^3 = 1, yz = zyx, xy = yx, xz = zx\rangle$$
This group has order 27, exponent three and is non-abelian. To see this you should check that each of $(yz)^3$, $(y^2z)^3$ and $(yx^2)^3$ define the trivial element. Then take $A=\mathbb{Z}_3^3$ to be the abelian group of order 27 and exponent three. Taking $G=A\times B$ and $H=B\times B$ solve the problem!
EDIT You can find non-abelian groups of order $p^n$ and exponent $p$, $p>2$, by considering the subgroup $S_n^p$ of $GL_n(\mathbb{Z}_p)$ consisting of upper-triangular matrices, so $S_3^p$ consists of matrices of the following form.
$$\left(
\begin{array}{ccc}
1&\ast&\ast\\
0&1&\ast\\
0&0&1
\end{array}
\right)$$
The $3\times 3$ matrix groups constructed this way are called Heisenberg groups, and its isomorphism class is that of the extra-special $p$-group of exponent $p$. This means that you can find lots of non-isomorphic groups with the same orders and spectra.
Best Answer
Let $H\subset G$ be a group of $p$ elements. $H$ is both left and right coset and it is easy to see that then $G\backslash H$ [just in case: elements of $G$ that are not in $H$] is also both left and right coset. If you take $g\in G\backslash H$, then all the elements of the kind $gg_1$, where $g_1\in G$ are different. Because for $g_1\in H$ we already get all $p$ elements of $G\backslash H$ as $gg_1$, it follows that $g^2\in H$. Now there are two cases: