Yeah as Gerry says, this isn't always true: consider the $x$-axis and $\{(x, e^{-x}) \; x \in \mathbb{R}\}$ in $\mathbb{R}^2$: the second asymptotically approaches $y = 0$ as $x \rightarrow \infty$, but never quite hits it.
However, this is true once one of either $A$ or $B$ is compact, say $A$.
To see this, as the distance between them is 0, we can take sequences of points $a_i \in A, b_i \in B$ such that $d(a_i, b_i) < \frac{1}{i}$, now extract a convergent subsequence $a'_i$ from the $a_i$, we have $a'_i \rightarrow a$, $b'_i \rightarrow a$, hence $a \in A \cap B$, as desired.