Here is a discrete analogue of the situation in which one really can literally take the transpose of a matrix that is analogous to gradient and get a matrix that is analogous to divergence.
Let $G$ be a finite graph with vertex set $V$ and edge set $E$, and let $\mathbb{R}^V, \mathbb{R}^E$ be the vector spaces of functions $V \to \mathbb{R}$ resp. $E \to \mathbb{R}$. (Actually $\mathbb{R}^E$ is slightly more complicated than this: we want to be able to refer to an edge from $u$ to $v$ as both $uv$ and as $vu$, subject to the condition that $f(uv) = -f(vu)$.) Given a function $f \in \mathbb{R}^V$, which we think of as a discrete analogue of a scalar function on $G$, we can define
$$\text{grad}(f)(uv) = f(v) - f(u)$$
and this gives a function $\text{grad}(f) \in \mathbb{R}^E$, which we think of as a discrete analogue of the gradient, but which is more typically known as the (oriented) incidence matrix of $G$. Note here the "fundamental theorem of discrete line integrals": if $v_1 \to v_2 \to ... \to v_n$ is a path, then
$$\sum_{i=1}^{n-1} \text{grad}(f)(v_{i+1} v_i) = f(v_n) - f(v_1)$$
as expected. Now, both spaces $\mathbb{R}^V, \mathbb{R}^E$ come equipped with inner products given by
$$\langle a, b \rangle_V = \sum_{v \in V} a(v) b(v)$$
and
$$\langle a, b \rangle_E = \sum_{e \in E} a(e) b(e)$$
respectively. Generally speaking, if $A, B$ are a pair of inner product spaces and $T : A \to B$ is a linear operator, then under nice conditions there exists a unique linear operator $T^{\dagger} : B \to A$ such that
$$\langle Ta, b \rangle_B = \langle a, T^{\dagger} b \rangle_A.$$
$T^{\dagger}$ is the adjoint of $T$, and this is the abstract definition of the transpose of a matrix. You can verify that if you pick orthonormal bases of $A, B$ and write $T$ in terms of those bases, then $T^{\dagger}$ is precisely the transpose of $T$ in the usual sense. Thus the operator $\text{grad} : \mathbb{R}^V \to \mathbb{R}^E$ has an adjoint. If we simply take the transpose of the matrix representing $\text{grad}$ (with respect to the orthonormal bases given by the functions which are equal to $1$ on a particular vertex or edge and $0$ otherwise) we get that for $g \in \mathbb{R}^E$,
$$\text{div}(g)(u) = \sum_{uv \in E} g(uv).$$
If we think of $g$ as a flow on the graph $G$, then this is precisely a measure of how much is flowing in or out of a particular vertex, so is an appropriate discrete analogue of the divergence, and in fact a discrete analogue of the divergence theorem holds.
In multivariable calculus, something similar is happening as above, except that the spaces and inner products are more complicated.