Let $\mathfrak g$ and $\mathfrak h$ be (finite-dimensional real) Lie algebras, and form their semidirect product $\mathfrak g \oplus_\pi \mathfrak h$ with respect to some homomorphism $\pi : \mathfrak g \to \text{Der}(\mathfrak h)$.
Suppose further that we have a linear representation of $\mathfrak g \oplus_\pi \mathfrak h$ (say as real matrices) so that $e_i$ and $f_j$ are bases of $\mathfrak g$ and $\mathfrak h$ respectively, and they satisfy the required commutator relations of $\mathfrak g \oplus_\pi \mathfrak h$. Then the canonical coordinates of the second kind $$ (x,y) \mapsto \prod_i \text{Exp}(x_ie_i) \prod_j \text{Exp}(y_jf_j) $$ represent (not necessarily faithfully) a connected Lie group with Lie algebra $\mathfrak g \oplus_\pi \mathfrak h$.
Question: Is this Lie group automatically a semidirect product of Lie groups in general?
More generally, given a Lie group whose Lie algebra is a semidirect product, is the group necessarily a semidirect product as well?
I think the answer is NO.
The reason is simply that the Lie algebra does not change if you consider a Lie Group or its universal cover or some its quotients by discrete subgroups of $Z(G)$.
Probably your statement is true if you suppose that G and H are simply connected and consider the only simply connected Lie group with Lie algebra $\mathfrak{g} \otimes_\pi \mathfrak{h}$ but actually I have no references to suggest.