I just wanted to add to Tyler Lawson's answer that all the maps $\beta\colon K(G,1)\rightarrow K(A,3)$ ($G$ and $A$ abelian and no action of $G$ on $A$) satisfying his additivity condition are loop maps by Stasheff's Homotopy Associativity of $H$-Spaces II (Theorem 5.3). Hence for 2-types being an $H$-space is the same as being a loop space. See also Qiaochu Yuan's comment.

In terms of $k$-invariants, the condition is that the $k$-invariant of the 2-type is in the image of the so-called cohomology 'suspension' morphism

$$H^4(K(G,2),A)\longrightarrow H^3(K(G,1),A),$$

which is induced by taking loops on the corresponding sets of homotopy classes of maps between Eilenberg-MacLane spaces.

The source is very well understood, it coincides with
$$\hom(\Gamma(G),A).$$
Here $\Gamma(G)$ is the target of the universal quadratic map $G\rightarrow\Gamma(G)$. Recall that a map $\gamma\colon G\to B$ between abelian groups is *quadratic* if $G\times G\to B\colon (x,y)\mapsto\gamma(x+y)-\gamma(x)-\gamma(y)$ is bilinear.

An example with non-trivial $k$-invariant can be constructed as follows. It suffices to show that

$$H^4(K(\mathbb{Z}/2,2),\mathbb{Z}/4)\longrightarrow H^3(K(\mathbb{Z}/2,1),\mathbb{Z}/4)$$

coincides with

$$\mathbb{Z}/4\twoheadrightarrow \mathbb{Z}/2.$$

Indeed, $H^3(K(\mathbb{Z}/2,1),\mathbb{Z}/4)$ is well-known to be the elements annihilated by $2$ in $\mathbb{Z}/4$, which identifies with $\mathbb{Z}/2$. A normalised $3$-cocycle representing the generator is
$$f\colon \mathbb{Z}/2\times \mathbb{Z}/2\times \mathbb{Z}/2\longrightarrow \mathbb{Z}/4,\qquad f(1,1,1)=2.$$
(I will omit notations for classes in quotients of $\mathbb{Z}$ since the meaning in each case will be clear from the context.)

The universal quadratic map for $\mathbb{Z}/2$ is $\gamma\colon \mathbb{Z}/2\rightarrow \mathbb{Z}/4$, $\gamma(0)=0$, $\gamma(1)=1$. Hence $\Gamma(\mathbb{Z}/2)=\mathbb{Z}/4$ and
$$\hom(\Gamma(\mathbb{Z}/2),\mathbb{Z}/4)=\hom(\mathbb{Z}/4,\mathbb{Z}/4)=\mathbb{Z}/4.$$

In order to compute the suspension morphisms I'm going to use crossed modules and their semi-stable version called reduced quadratic modules by Baues (see his book on 4-dimensional complexes). It is well known that 3-dimensional group cohomology classifies crossed modules (Eilenberg-MacLane or one of them alone, I don't currently remember). Similarly $\hom(\Gamma(\mathbb{Z}/2),\mathbb{Z}/4)$ classifies reduced quadratic modules. The generator is represented by the reduced quadratic module
$$\mathbb{Z}\otimes \mathbb{Z} \stackrel{\langle-,-\rangle}\longrightarrow \mathbb{Z}\oplus \mathbb{Z}/4\stackrel{\partial}\longrightarrow \mathbb{Z}$$
where $\partial(a,b)=2a$ and $\langle x,y\rangle =(0,{xy}).$ This is because $\ker \partial=\mathbb{Z}/4$, $\operatorname{coker}\partial=\mathbb{Z}/2$ and the map $\mathbb{Z}/2\mapsto \mathbb{Z}/4$ defined by ${x}\mapsto{\langle x,x\rangle}$ coincides with the aforementioned universal quadratic map. The loop crossed module of this reduced quadratic module is
$$\mathbb{Z}\oplus \mathbb{Z}/4\stackrel{\partial}\longrightarrow \mathbb{Z},$$
where the source is equipped with an exponential action of the target defined by
$$x^a=x+\langle\partial(x),a\rangle.$$
(Crossed modules usually consist of non-abelian groups and reduced quadratic modules too, but in this case everything is abelian because they are very small, this simplifies a lot the computations). A 3-cocycle
$$g\colon \mathbb{Z}/2\times \mathbb{Z}/2\times \mathbb{Z}/2\longrightarrow \mathbb{Z}/4$$
representing the cohomology class of this crossed module is defined by the following choices:

We first need a set-theoretic splitting of $\partial$, that we define as
$$s\colon \mathbb{Z}/2\longrightarrow \mathbb{Z},\qquad s(0)=0,\quad s(1)=1.$$
Now, for each pair of elements $x,y\in \mathbb{Z}/2$ we need $t(x,y)\in \mathbb{Z}\oplus \mathbb{Z}/4$ such that
$$\partial(t(x,y))=-s(y)-s(x)+s(x+y).$$
This measures the failure of $s$ to be a morphism.
We take $t(0,-)=(0,0)$, $t(-,0)=(0,0)$, and $t(1,1)=(1,0)$.
With these choices $g$ is
$$g(x,y,z)=t(x,y)^{s(z)}+t(x+y,z)-t(x,y+z)-t(y,z)\in\ker\partial=\mathbb{Z}/4.$$
Different choices produce cohomologous cocycles.
This cocycle is normalised because $t(0,-)$ and $t(-,0)$ vanish, so we only have to compute
$$\begin{array}{rcl}
g(1,1,1)&=&t(1,1)^{s(1)}+t(1+1,1)-t(1,1+1)-t(1,1)\\
&=&t(1,1)+\langle \partial t(1,1), s(1)\rangle +t(0,1)-t(1,0)-t(1,1)\\
&=&\langle \partial t(1,1), s(1)\rangle\\
&=&\langle \partial (1,0), 1\rangle\\
&=&\langle 2, 1\rangle\\
&=&(0,2).
\end{array}$$
The second coordinate (the kernel of $\partial$) is $2\in \mathbb{Z}/4$, therefore, $g=f$ above. This concludes the proof of the claim.