The Macaulay duration is a measure of how sensitive a bond's price is to changes in interest rates. Duration is related to, but differs from, the slope of the plot of bond price against yield-to-maturity. The slope of the price-yield curve is
$-\frac{D}{1+r}P,$
where $D$ is Macaulay duration, $P$ is bond price, and $r$ is yield.
Here's how the definition of duration arises. Let's expand the price of a bond, $P$, in terms of the yield-to-maturity, $r$, using Taylor's theorem:
$$\Delta P=P(r+\Delta r)-P(r)\approx\frac{\partial P(r)}{\partial r}\Delta r+\frac{1}{2}\frac{\partial^2 P(r)}{\partial r^2}(\Delta r)^2.$$
Since
$$P(r)=\sum_{t=1}^{T}\frac{C_t}{(1+r)^t},$$
where $C_t$ are the cash flows, we have that
$$\Delta P\approx -\frac{\Delta r}{1+r}\sum_{t=1}^{T}\frac{t\ C_t}{(1+r)^t}+\frac{(\Delta r)^2}{2(1+r)^2}\sum_{t=1}^{T}\frac{t(t+1)C_t}{(1+r)^t},$$
and dividing both sides by $P$, we arrive at the expression
$$\frac{\Delta P}{P}\approx -\frac{D}{1+r}\Delta r+\frac{\mathcal C}{2}(\Delta r)^2.$$
Here
$$D=\frac{1}{P} \sum_{t=1}^{T}\frac{t\ C_t}{(1+r)^t}$$
is the Macaulay duration, and
$$\mathcal C= \frac{1}{P(1+r)^2}\sum_{t=1}^{T}\frac{t(t+1)C_t}{(1+r)^t}$$
is a measure of curvature, or convexity, in the plot of bond price against yield-to-maturity.