Let us suppose that $X$, with a 2form $\omega$. Suppose $J$ is an element of $su(2)$ such that $J^2=e$ for $e$ the identity. Is there a necessary and sufficient condition on $\omega$ which will give the existence of $E\rightarrow X$ a $SU(2)$ bundle with a connection whose curvature is $J\omega$?

An obvious necessary local condition is that $d\omega=0$. On the open set $U\subset X$ on which $\omega^2\not=0$, one has the further condition that the only ${\frak su}(2)$valued connection that could have curvature $J\omega$ is one that is locally of the form $J\alpha$, where $\omega = d\alpha$. This may mean (I haven't checked the mod 2 conditions) that any such $E$ would have to restrict to $U$ to be of the form $E = L \oplus \overline L$, where $L$ is a complex line bundle with curvature $\omega$. Here is the reasoning behind the above statements: Recall that ${\frak su}(2)$ can be regarded as the space of imaginary quaternions, with standard basis ${\bf i},{\bf j},{\bf k}$. Our curvature form can then be written as $\Omega = \omega {\bf i}$, and a potential connection form would be $\alpha = \alpha_1 \textbf{i} + \alpha_2\textbf{j} + \alpha_3 \textbf{k}$ for some (at the moment, only locally defined) $1$forms $\alpha_i$. Now, the curvature equation $d\Omega = d\alpha + \alpha \wedge \alpha$ implies the Bianchi identity $d\Omega = \Omega \wedge \alpha  \alpha \wedge\Omega$, which unravels to the three equations $$ d\omega = 0\quad\text{and}\quad \omega\wedge\alpha_2 = \omega \wedge\alpha_3 = 0. $$ Thus, $\omega$ must be closed. Moreover, if $\omega^2\not=0$, the second and third equations imply that $\alpha_2 = \alpha_3 =0$, so that one must have $\omega = d\alpha_1$, and the connection must keep the splitting of $E$ into the sum of two (conjugate) line bundles invariant under parallel translation. There is unlikely to be a simple sufficient condition without making some constant rank assumptions on $\omega$, there are just too many possibilities. I'll add some remarks about the case when $\omega^2=0$ but $\omega\not=0$ when I have time. 


The case $\omega^2=0$ holds always when $M$ is a surface, and I want to restrict to the case of compact oriented surfaces of genus $g\geq2.$ Lets say you have a flat $SL(2,\mathbb C)$connection $\nabla$ on a topological trivial bundle $V\to M$ whose underlying holomorphic structure $$\bar{\partial}=\frac{1}{2}(\nabla+i*\nabla)$$ is stable ($\star$ is the Riemann surface $\star,$ i.e. it is given on $1$ forms by $\star dz=idz,\star d\bar z=id\bar z).$ Stability implies that there are no nontrivial holomorphic endomorphisms, i.e. $$H^0(M;End(V,\bar\partial)=\mathbb C Id.$$ This case occurs for example when $\nabla$ is an irreducible flat $SU(2,\mathbb C)$ connection by a Weitzenboeck argument. By Serre duality and with $End_0(V)=(End_0(V))^*$ via trace $$H^1(M,KEnd_0(V))=H^0(M,End_0(V))=\{0\}$$ which means that every $2$form with values in the trace free endomorphisms is in the image of $\bar\partial.$ This implies there exists $\alpha\in\Gamma(M, KEnd_0(V))$ with $$F^{\nabla+\alpha}=F^\nabla+d^\nabla\alpha=0+\bar\partial\alpha=J\omega$$ as $J\omega$ is trace free. 

