Pearson's correlation coefficient is dimensionless and scaled between -1 and 1 regardless of the dimension and scale of the input variables.
If (for example) you input a mass in grams or kilograms, it makes no difference to the value of $r$, whereas this will make a tremendous difference to the gradient/slope (which has dimension and is scaled accordingly ... likewise, it would make no difference to $r$ if the scale is adjusted in any way, including using pounds or tons instead).
A simple demonstration (apologies for using Python!):
import numpy as np
x = [10, 20, 30, 40]
y = [3, 5, 10, 11]
np.corrcoef(x,y)[0][1]
x = [1, 2, 3, 4]
np.corrcoef(x,y)[0][1]
shows that $r = 0.969363$ even though the slope has been increased by a factor of 10.
I must confess it's a neat trick that $r$ comes to be scaled between -1 and 1 (one of those cases where the numerator can never have absolute value greater than the denominator).
As @Macro has detailed above, slope $b = r(\frac{\sigma_{y}}{\sigma_{x}})$ , so you are correct in intuiting that Pearson's $r$ is related to the slope, but only when adjusted according to the standard deviations (which effectively restores the dimensions and scales!).
At first I thought it odd that the formula seems to suggest a loosely fitted line (low $r$) results in a lower gradient; then I plotted an example and realised that given a gradient, varying the "looseness" results in $r$ decreasing but this is offset by a proportional increase in $\sigma_{y}$.
In the chart below, four $x,y$ datasets are plotted:
- the results of $y=3x$ (so gradient $b=3$, $r=1$, $\sigma_{x}=2.89$, $\sigma_{y}=8.66$) ... note that $\frac{\sigma_{y}}{\sigma_{x}}=3 $
- the same but varied by a random number, with $r = 0.2447$, $\sigma_{x}=2.89$, $\sigma_{y}=34.69$, from which we can compute $b= 2.94 $
- $y=15x$ (so $b=15$ and $r=1$, $\sigma_{x}=0.58$, $\sigma_{y}=8.66$)
- the same as (2) but with reduced range $x$ so $ b= 14.70$ (and still $r = 0.2447$, $\sigma_{x}=0.58$, $\sigma_{y}=34.69$) $r$ without necessarily affecting $b$, and units of measure can affect scale and thus $b$ without affecting $r$" />
It can be seen that variance affects $r$ without necessarily affecting $b$, and units of measure can affect scale and thus $b$ without affecting $r$