What are the necessary and sufficient conditions for a group $H$ to be a central extension of the quaternions $Q_8$ ?

So you mean "central extension". Let $H/K \cong Q_8$ with $K \le Z(H)$. Since $Q_8$ has trivial Schur Multiplier, $K \cap H' = 1$, so $H' = 2$, and $H$ is a subdirect product of an abelian group $L$ with $Q_8$, where $L$ and $Q_8$ have the common quotient $V = C_2^2$ (the Klein 4group). More precisely, let $L$ be an abelian group with an epimorphism $\phi:L \to V$ and let $\psi:Q_8 \to V$ be an epimorphism. Then $H = \{ (g,h) \mid g \in L, h \in Q_8, \phi(g)=\psi(h) \}$. Further explanation follows. First note that $Q_8$ has a presentation with two generators and two relations, namely $\langle x,y \mid x^2=y^2, y^{1}xy=x^3 \rangle$. Let $G$ be a any finite group with a presentation with $n$ generators and $n$ relations for some $n$. So we can write $G=F/R$ with $F$ free of rank $n$, and $R$ the normal closure in $F$ of $n$ elements of $F$. So $R/[R,F]$ is an $n$generated abelian group. Now $R[F,F]/[F,F]$ has finite index in the rank $n$ free abelian group $F/[F,F]$, and so it is also free abelian of rank $n$. But $R[F,F]/[F,F] \cong R/(R \cap [F,F])$, so the $n$generated abelian group $R/[R,F]$ has the rank $n$ free abelian quotient $R/(R \cap [F,F])$. Hence $(R \cap [R,F])/[R,F]$ (which is the Schur Multiplier of $G$) is trivial. Now we can lift the epimorphism $F \to Q_8$ to a homomorphism $\rho:F \to H$. Since $K \le Z(H)$ and $H = K {\rm Im}(\phi)$, this implies that $H' \le \phi([F,F])$, and so $H' \cap K \le \phi(R \cap [F,F])$. Note that $K \le Z(H)$ implies that $[R,F] \le {\rm Ker}(\phi)$, and so $[R,F] = R \cap [F,F]$ implies $H' \cap K = 1$. 

