Why can stock prices be modeled with a random walk?
They can if you want to, but they don't have to.
What I mean is that stock returns (not prices) are usually modeled as a random walk by researchers trying to understand markets. Market participants, however are certainly not trading because they believe prices are random, they are precisely trading because they believe prices are not random. They trade for profit. How can researchers believe markets are random, is because that is what they are observing. Let me explain.
Trades are fast processes by which prices move up or down when some market participants make money, and the same number of participants lose money. In a physical setting, these are transient phenomena. If you're looking for general laws that govern markets, you're going to look at large sets of stocks over large periods of time, to obtain a decent statistics. In your analysis, you will treat trades as noise, departure from normality.
And you will miss the very reason people trade in the first place: profit. To trade means to sell what you don't want, because you believe its price is going down, to someone who wants it because he believes the exact opposite.
So you certainly can treat prices as random. The question is should you?