This is because the same amount of money does not have the same value across time. \$100 today is not worth the same as \$100 tomorrow, which is not worth the same as \$100 in 2025.
There are several reasons for why money have different value across time. These reasons include inflation, people's impatience, peoples opportunity cost (of postponed consumption), and so on. Most of these factors are already expressed in interest rate you can earn on your saving which is compensation you get for postponing your consumption (see discussion in Mankiw Principles of Economics Ch 27 or this recent Economics.SE answer).
Next, stock fundamentally (now taking the ownership rights and other matters aside) represents a streams of cashflow.
If you purchase stock today and hold it for one year and then collect your dividend $D_1$ and then sell the stock for its price next year $P_1$ what you are purchasing is essentially a stream of cashflow $D_1+P_1$. For example, if the stock sells next year for \$200 and pays dividend of $\\\$10$, you are purchasing little more than a \$210 cash stream you receive next year (again now I am putting issues like ownership/voting rights which the stock entitles you to aside).
As a consequence, if you want to know what the value of the stock will be today (i.e. its price today $P_0$), you need to essentially discount the present value of the cashflow you are receiving for correcting the fact that money today has different value as money tomorrow (the same way as if scientists would decide to create new meter that is 2x our current meter all heights would have to be recalculated).
The time value of money formula is given by:
$$PV=\frac{FV}{1+r}$$
where $PV$ is present value, $FV$ future value and $r$ interest or more broadly some discount rate.
So continuing the example above if we want to know what a stocks current price is we would take the future stream of cashflow we will get from the stock and discount it:
$$P_0 = \frac{P_1+D_1}{1+r}$$
So with the $P_1=200$ and $D_1=10$ and assuming $r=0.06$ (or 6%), the stock that I can later sell for \$200 (after getting \$10 dividend) should sell for:
$$P_0 = \frac{200+10}{1+0.06} \approx 198.11$$
Now you should note the above is oversimplification as stocks are not just streams of cash, and of course in real life you cannot know what $P_1$ and $D_1$ will be next year with certainty, but the point is that value of stocks today necessarily depends on their discounted future value and value of dividends they earn you. More complex models try to take into account more factors but they still take this time value of money into account.