I know that the amalgamated free product of two groups $G\star_K H$ has a certain topological meaning. What about a semi-direct product $H \rtimes G$ ?
[Math] Topological Meaning of semi-direct product
algebraic-topologygroup-theory
Related Solutions
The quaternion group is indeed the minimal counter-example. Clearly, any group of orders $1,2,3,5$ or $7$ is cyclic, and the two (non-isomorphic) groups of order $4$ are:
$\Bbb Z_4$ and $\Bbb Z_2 \times \Bbb Z_2$.
There are likewise just two non-isomorphic groups of order $6$:
$\Bbb Z_6$ and $S_3 \cong \Bbb Z_3 \rtimes \Bbb Z_2$ (this is the only possible non-trivial semi-direct product of these two groups, since:
$0 \mapsto 1_{\Bbb Z_3}\\1 \mapsto (x \mapsto -x)$
is the sole non-trivial homomorphism $\Bbb Z_2 \to \text{Aut}(\Bbb Z_3)$).
It is convenient to use this formulation of a(n internal) semi-direct product:
$G = NH$, where $N,H$ are subgroups of $G$, and $N \lhd G$.
$N \cap H = \{e_G\}$.
The problem with obtaining $Q_8$ as a semi-direct product of two proper subgroups, is that we must have either $|H|$ or $|N|$ equal to $2$. But the only subgroup of order $2$ in $Q_8$ is $\{1,-1\}$, which is a subgroup of every subgroup of $Q_8$ of order $4$:
$\langle i\rangle = \{1,-1,i,-i\}\\\langle j\rangle = \{1,-1,j,-j\}\\\langle k\rangle = \{1,-1,k,-k\}$
Note that all $6$ elements of order $4$ lie in one of these $3$ subgroups.
Thus the condition $N \cap H = \{e_G\}$ (which is $=\{1\}$ in this case) is impossible to satisfy.
Let $F_1,F_2$ be non-cyclic finitely generated groups. Then $F_1\times F_2$ is not amalgamated product or HNN extension over a cyclic subgroup.
Let $F_1,F_2$ be non-cyclic finitely generated groups. Suppose that $G=F_1\times F_2$ acts unboundedly, inversion-free, on a tree $T$ with cyclic edge stabilizers.
Suppose that each element of $F_1$ acts with a fixed vertex. Then $F_1$ has a fixed vertex (this is a general fact on tree actions of f.g. groups). Let $T_1$ be the set of vertices fixed by $F_1$. Then $T_1$ is a subtree, and is $F_2$-invariant. By minimality, we deduce that $T=T_1$, and hence $F_1$ acts trivially. Since $F_1$ is not cyclic, it follows that edge stabilizers are not cyclic, contradiction.
So some element $g_1$ of $F_1$ is loxodromic, with axis $A_1$. Similarly, some element $g_2$ of $F_2$ is loxodromic, with axis $A_2$. Since $F_2$ commutes with $g_1$, $F_2$ preserves $A_1$, and hence $A_2=A_1$, and since $F_1$ commutes with $g_2$, $F_1$ preserves $A_2=A_1$. So the action preserves an axis, hence by minimality $T$ is reduced to an axis.
Hence $G$ modulo a cyclic normal subgroup is trivial, of order $2$, infinite cyclic, or dihedral. This is excluded by the assumptions.
Best Answer
The wording of your question is rather vague but hopefully the following will hint at least a little at one example of how the semi-direct product of the fundamental groups of topological spaces can arise naturally in common constructions. I apologise in advance if any of the definitions below aren't known to you. They should all be easily searchable on wikipedia.
If you don't know anything about fiber bundles (or the more general family of maps fibrations) then to put it very loosely, a map $p\colon E\rightarrow B$ is a fiber bundle if for all $b\in B$, the preimage of a neighbourhood $U\ni b$ is homeomorphic to the product of some space $F$ and $U$. That is, $p^{-1}(U)\cong F\times U$. We often write that the sequence of maps $F\rightarrow E\rightarrow B$ is a fibration sequence with fiber $F$ (the first map in this sequence is just inclusion of $F$ in $E$).
The proper definition puts some restrictions on the map $p$ but the above definition is good enough to give an intuitive feel for what fiber bundles 'look like'. The important part you should take away from the definition is that the space $E$ can be seen as a kind of 'twisted product' of the spaces $F$ and $B$. You should hopefully already be able to see a loose parallel between fiber bundles and semi-direct products of groups.
A very useful property of fiber bundles of 'nice spaces' (roughly speaking, if all the spaces involved are CW-complexes then we're fine) is that the homotopy groups of the fibration sequence fit in to a long exact sequence. Now, suppose that the space $F$ is connected and $\pi_2(B)=0$. Then from this long exact sequence in homotopy, we can extract the short exact sequence $$\pi_2(B)=0\rightarrow\pi_1(F)\rightarrow\pi_1(E) \rightarrow\pi_1(B)\rightarrow 0=\pi_0(F)$$ and now it should be clear that if this short exact sequence splits, then the splitting lemma for non-ableian groups tells us that $\pi_1(E)\cong \pi_1(F)\rtimes \pi_1(B)$.
The conditions on the homotopy groups of $B$ and $F$, and the requirement that the short exact sequence splits are rather specialised. So, this is far from a universally useful construction, but hopefully it's the sort of link between fundamental groups and semi direct product of groups that you were looking for.
Following the comments of KotelKanim below, the conditions on the homotopy groups of $B$ and $F$ are not necessary as long as the fiber bundle involved has a section. This means that there exists a map $s\colon B\to E$ such that $p\circ s=\mbox{Id}_B$.
Suppose the bundle $p$ has a section $s$ and let $\delta\colon\pi_n(B)\to\pi_{n-1}(F)$ be the connecting homomorphism in the associated long exact sequence of homotopy groups. Suppose $\ker\delta\neq\pi_n(B)$. Then by exactness at $\pi_n(B)$ we have $\mbox{Im}\, p_*\neq \pi_n(B)$ and so let $h$ be an element of $\pi_n(B)\setminus\mbox{Im}\, p_*$. We have $h=\mbox{Id}_{\pi_n(B)}(h)=p_*(s_*(h))$ but then this implies that $h\in\mbox{Im}\, p_*$ which is a contradiction. It follows that $\ker\delta=\pi_n(B)$ and so $\mbox{Im}\,\delta=0$.
Hence we get the augmented long exact sequence in homotopy $$\cdots \rightarrow \pi_{n+1}(B)\rightarrow 0\rightarrow\pi_n(F)\rightarrow\pi_n(E) \rightarrow\pi_n(B)\rightarrow 0 \rightarrow \pi_{n-1}(F) \rightarrow \cdots$$ because $\delta$ factors through $0$ and so we have a split short exact sequence for each $n$ which, by the splitting lemma, gives us the isomorphism $\pi_n(E) \cong \pi_n(F) \oplus \pi_n(B)$ for $n\geq 2$ (as higher homotopy groups are abelian) and for $n=1$ gives us the previous semi-direct product.