May I rephrase your question into the broader question "Can economic growth continue indefinitely?"
(In response to objections that eventually the sun will burn out or the universe will suffer heat death, I take indefinite to mean "lasting for an unknown or unstated length of time" (OED). So I am thinking of 100s, 1000s, or even 10000s of years ahead. But I am not thinking of billions of years ahead or the "infinite future".)
Non-economists commonly believe the answer to be "no", giving some reason along the lines of "resources are finite!"
But the economist's answer to this is "Yes, of course economic growth can continue indefinitely." And so to answer also your narrower question, "Yes, of course the stock market can show indefinite exponential growth." (By "can", I mean that this is at least conceivable. Whether it will is a different matter altogether. After all the world might end tomorrow in a nuclear apocalypse.)
I think we can distinguish between two common fallacies at work here.
Fallacy #1. "Economic growth is about making ever more "stuff", digging ever more gold and other natural resources out of the ground, burning ever more energy, etc." (This caricature is perhaps why many non-economists and especially environmentalists are averse to economists and the idea of economic growth.) The fallacy typically continues, "Resources/the universe is finite. Therefore economic growth must also be finite."
But this is wrong. Economic growth is about improving human well-being, broadly conceived.
It is true that for a long time (the past few centuries), improvements in human well-being were largely through improvements in material well-being and highly-correlated with making ever more stuff and burning ever more energy. After all, it was not two centuries ago that the vast majority of mankind lived at bare subsistence level. (Indeed, even today, many people still do.)
But going forward, it is perfectly conceivable that we make ever less "stuff", dig ever less "stuff" out of the ground, and burn ever less energy, and yet still become ever more well-off. This is actually already happening today in the rich countries (see e.g. falling energy use, briefly analyzed below).
Since the 1930s and 1940s, we've measured economic growth mostly by GDP growth. But economists have always recognized that GDP is a very flawed measure of well-being. Economists are working on alternatives that better capture the notion of improvements in human well-being or equivalently, economic welfare. I do not expect that in 100 years, the current concept of GDP without fundamental modifications will still be used to as the primary measure of economic well-being.
(Footnote: Perhaps in the future, we will also include non-human well-being in our conception of economic growth. But for now, we still restrict attention mostly to human well-being.)
Fallacy #2. "Bad things (like the consumption of food or resources) will grow rapidly or even exponentially. In contrast, offsetting good things (like technology) can at best grow arithmetically. Therefore, there are necessarily limits to growth."
This fallacy is not new. Here's an example of doom-and-gloom predictions from each of the past three centuries, all of which proved to be wrong.
2010 commentary:
Malthus began with two “fixed laws of our nature.” First, men and
women cannot exist without food. Second, the “passion between the
sexes” drives them to reproduce.
He explained that, if unchecked, people breed “geometrically” (1, 2,
4, 8, 16, etc.). But, he continued, the production of food can only
increase “arithmetically” (1, 2, 3, 4, 5, etc.). “The natural
inequality of the two powers of population and of [food] production in
the earth,” he declared, “form the great difficulty that to me appears
insurmountable [impossible to overcome].”
Malthus concluded: “I see no way by which man can escape from the
weight of this law.” In other words, if people keep reproducing in an
uncontrolled geometric manner, they will eventually be unable to
produce enough food for themselves. The future, Malthus argued,
pointed not to endless improvement for humanity, but to famine and
starvation.
Writing in the Times of London in 1894, one writer estimated that in 50 years every street in London would be buried under nine feet of manure. Moreover, all these horses had to be stabled, which used up ever-larger areas of increasingly valuable land. And as the number of horses grew, ever-more land had to be devoted to producing hay to feed them (rather than producing food for people), and this had to be brought into cities and distributed—by horse-drawn vehicles. It seemed that urban civilization was doomed.
Our attempts to use even the most optimistic estimates of the benefits of technology in the model did not prevent the ultimate decline of population and industry, and in fact did not in any case postpone the collapse beyond the year 2100 (p. 145.).
This was a highly-influential best-seller that has sold over 16M copies in over 30 languages.
Take their example of gold. On p. 56, they calculate that if gold use continued growing exponentially AND there was 5 times as much gold available as there were known gold reserves (they thought this was a very optimistic assumption), gold would be depleted in 29 years, or in 2001.
Surprisingly, 2001 came and went and gold continued to be mined. Indeed, more than ever. Gold mining graph (source):

Roughly every 5 years since 1972, The Limits to Growth folks (AKA the Club of Rome) have released a new update to their 1972 book, each time explaining why they had been correct all along (of course) and sometimes pushing back their predictions about when the eventual collapse will set in. In their 30-Year Update, they make no mention whatsoever of gold.
The following is the response by two critics to The Limits to Growth, also quoted by Robert Solow in a Newsweek article:
The authors load their case by letting some things grow exponentially
and others not. Population, capital and pollution grow exponentially
in all models, but technologies for expanding resources and
controlling pollution are permitted to grow, if at all, only in
discrete increments.
(Footnote: Doomsday-mongering was especially fashionable in the West around the 1970s. See also the famous Simon-Ehrlich wager at around the same time.
Predictions at the polar extremes capture the public's attention. Ray Kurzweil comes to mind as someone who makes similar predictions, but at the polar opposite.
In contrast, the median economist is cautiously optimistic, believing merely that slow but steady, sustained growth is possible. No doomsday, no stagnation, but no impending Singularity either. Not exactly a position that sells many books.)
In 2012, a physics professor wrote a somewhat-influential blogpost: Exponential Economist Meets Finite Physicist, exhibiting both of the above fallacies. That someone as intelligent as a physics professor could commit both fallacies shows that economists must do a far better job at educating the public.
There is plenty that is wrong in that blogpost and perhaps I will do a sentence-by-sentence dissection elsewhere, but this is probably not the proper avenue. Here I'll merely point out one obvious factual error that's of particular relevance. He claims as fact that
energy growth has far outstripped population growth, so that
per-capita energy use has surged dramatically over time—our energy
lives today are far richer than those of our great-great-grandparents
a century ago [economist nods]. So even if population stabilizes, we
are accustomed to per-capita energy growth: total energy would have to
continue growing to maintain such a trend [another nod].
As Tim Harford points out, this is FALSE. In recent decades, energy growth per person in many countries has actually been falling, even as GDP per capita has risen. Graph (data from World Bank, June 1st 2017 update):

In every rich country, per-capita energy use peaked years ago and has been falling ever since. In fact, in some countries, it peaked DECADES ago (peaked in 1978 in the US, in 1979 in Germany, and in 1973 in the UK).
(One would've hoped that a physics professor backed up his factual claims with something more than a fictitious and bumbling economist who repeatedly nods.)
See also falling energy intensity (energy use per unit of GDP) (source):

The highest per-capita energy use ever attained was the US in 1978. My prediction is that global average human well-being will keep improving, but global per-capita energy use will never hit the US 1978 peak (at least not until we start populating other planets and stars).