Your definition of distance between sets $A$ and $B$ doesn't work for some metric spaces. Consider two examples.
Let $S = \mathbb{Q}$. Let $A=[0,\sqrt{2}) \cap \mathbb{Q}$ and $B = \{2\}$. Sets $A$ and $B$ are closed bounded subsets of the metric space $S$. However, $\min\{d(a,b): a\in A, b\in B\}$ is not defined (but $\inf\{d(a,b): a\in A, b\in B\} = 2 - \sqrt{2}$).
Now let $S = \ell_1$. Let $e_i$ be the standard basis of $\ell_1$. Let $A = \{e_i: i\in{\mathbb{N}}\}$ and $B = \{(1 - 1/i) e_i: i\in{\mathbb{N}}\}$. Sets $A$ and $B$ are bounded and closed. Again, $\min\{d(a,b): a\in A, b\in B\}$ is not defined (but $\inf\{d(a,b): a\in A, b\in B\} = 0$).
To avoid this problem, let us assume that $A$ and $B$ are compact sets (or, alternatively, that $S$ is a complete metric space, and $A$ and $B$ are totally bounded sets).
To ensure that $d(A,B) = d(\partial A, \partial B)$, it is sufficient to assume that $S$ is a path metric space (of course, it is a sufficient but not a necessary condition). Recall that $S$ is a path metric space if the distance between every pair of points equals the infimum over of the lengths of curves joining the points (see [Gromov “Metric structures for Riemannian and non-Riemannian spaces”]). In particular, all normed spaces are path metric spaces. Also a closed Riemannian manifold equipped with the geodesic metric is a path metric space.
Proof. Suppose that $S$ is a path metric space. Consider compact subsets $A,B \subset S$. We want to prove that $d(A,B) = d(\partial A, \partial B)$. Suppose to the contrary that $d(A,B) < d(\partial A, \partial B)$. Let $a\in A$ and $b\in B$ be such that $d(a,b) = d(A,B)$.
Choose $\varepsilon > 0$ such that $(1 + \varepsilon) d(A,B) < d(\partial A, \partial B)$. Since $S$ is a path metric space, there is a curve $\gamma:[0,1]\to S$ with $\gamma(0) = a$ and $\gamma (1) = b$ of length at most $(1 + \varepsilon) d(A,B)$. This curve cannot intersect both $\partial A$ and $\partial B$, as otherwise the distance between $\partial A$ and $\partial B$ would be at most $(1 + \varepsilon) d(A,B)$. On the other hand, $\gamma(t_A) \in \partial A$ for $t_A = \sup \{t: \gamma(t) \in A\}$ and $\gamma(t_B) \in \partial B$ for $t_B = \inf \{t: \gamma(t) \in B\}$. We get a contradiction. QED
Here is an example when $d(A,B) \neq d(\partial A, \partial B)$. Let $S= [-1,1]\times \{0,1\}$. Define
\begin{align*}
d((x,0),(y,0)) &= d((x,1),(y,1)) = |x-y|;\\
d((x,0),(y,1)) &= |x| + |y| + 1.
\end{align*}
It is easy to verify that $(S, d)$ is a complete metric space. Let $A = [-1,1] \times \{0\}$ and $B = [-1,1] \times \{1\}$. We have, $\partial A = \{-1,1\} \times \{0\}$ and $\partial B = \{-1,1\} \times \{1\}$. Thus
$$d(A,B) = d((0,0), (0,1)) = 1$$
but
$$d(\partial A, \partial B) = d((1,0),(1,1)) = 3.$$
HINTS:
(1) If $\operatorname{dist}(A,B)>\operatorname{dist}(x,A)+\operatorname{dist}(x,B)$, it follows from the definition of supremum that there are $a\in A$ and $b\in B$ such that $d(a,b)>\operatorname{dist}(x,A)+\operatorname{dist}(x,B)$. Now apply the triangle inequality.
(2) Let $b\in B$; then $d(x,a)\le d(x,b)+d(b,a)$.
Best Answer
Your assumption that, if $A,B\subset\Bbb R$, then$$\operatorname{dist}(A,B)=|\sup(A)-\inf(B)|\tag1$$is wrong. Note that if you exchange $A$ and $B$, then the number $\operatorname{dist}(A,B)$ reamins the same, whereas $|\sup(A)-\inf(B)|$ changes (in general). Anyway, if$$A=\left\{\frac1n\,\middle|\,n\in\Bbb N\right\}\quad\text{and}\quad B=\left\{\frac{\sqrt2}n\,\middle|\,n\in\Bbb N\right\}$$then $\operatorname{dist}(A,B)=0$, but $\inf(A)=\inf(B)=0$, $\sup(A)=1$ and $\sup(B)=\sqrt2$. So you neither have $(1)$ nor $\operatorname{dist}(A,B)=|\sup(B)-\inf(A)|$.