The Gysin sequence in the form you need is a purely topological based on the long exact cohomological sequence of a pair, the Thom isomophism and Poincare duality.
The Gysin sequence is obtained from the long exact sequence of the pair $(T(D), \partial T(D))$ where $T(D)$ is a tubular neighborhood of $D$ in $X$. Note that we have a natural projection $\pi: T(D)\to D$. Moreover, by excision
$$ H^\bullet(T(D),\partial T(D)\;)\cong H^\bullet (X, X\setminus D). $$
$\newcommand{\pa}{\partial}$
If $D$ is compact then it carries a homology class $[D]$ and its Poincare dual is the Thom class $\tau\in H^2(T(D),\partial T(D))$.
The Thom isomorphism theorem states that the map $\Psi: H^\bullet (T(D)D)\to H^{\bullet +2}(T(D),\pa T(D))$ given by
$$
H^kT(D)\cong H^k(D)\ni \alpha \mapsto \tau \cup \pi^*\alpha\in H^{k+2}(T(D),\pa T(D))
$$
is an isomorphism.
The long exact sequence
$$
\cdots \to H^k(T(D),\pa T(D))\to H^k(T(D))\to H^k (\pa T(D))\to H^{k+1}(T(D),\pa T(D))\to\cdots
$$
can be rewritten using the Thom isomorphism in the form
$$
\cdots \to H^{k-2}(T(D))\to H^k(T(D))\to H^k (\pa T(D))\to H^{k-1}(T(D))\to\cdots
$$
Note that $H^\bullet(T(D))\cong H^\bullet (D)$ so we obtain
$$
\cdots \to H^{k-2}(D)\to H^k(D)\to H^k (\pa T(D))\to H^{k-1}(D)\to\cdots
$$
We set $N:=\dim_{\mathbb{C}} X$ and $m:=2N-k$.
Using the Poincare dualities
$$
H^j(D)\cong H_{2N-2-j}(D),\;\; H^j(\pa T(D))\cong H_{2N-1-j}( \pa T(D))
$$
we obtain a long exact sequence
$$\cdots \to H_m(D)\to H_{m-2}( D) \stackrel{T}{\to} H_{m-1}(\pa T(D))\to H_{m-1}(D)\to\cdots .$$
Above, $T$ is the so called tube morphism. Its Kronecker dual is the Residue morphism. See these notes for more details.
If $D$ is non-compact, then you will have to use Borel-Moore homology $H_\bullet^{BM}$ instead of the usual homology,
$$ H_\bullet^{BM}(X,\mathbb{C})={\rm Hom}\;(\; H^\bullet_{cpt}(X,\mathbb{C}),\mathbb{C}\;). $$