The answer to your question depends on what you mean when you say "growth". If you mean a literal increase in the aggregate market capitalization of companies, across the entire market, then, no, this sort of growth is not possible without concomitant economic growth. The reason why is that the market capitalization of each company is proportional to its gross revenue, and the sum of all revenue from selling "final goods" (i.e., things purchased and used by consumers) is, apart from a few technicalities, the definition of GDP. The exact multiplier might fluctuate up or down depending on investors' expectations about how sales will grow or decline going forward, but in a zero-growth economy this multiplier should be stable over the long run. It might, however, still fluctuate over the short term, but more about that in a minute.
Note that all of this applies to aggregate growth across all firms. Individual firms can still grow, of course, but as they must do this by gaining market share from other companies such growth would be balanced by a decline for some other firm. Also, I've assumed zero net exports (that's one of the "technicalities" I mentioned above) because obviously you could have export-driven growth even if the domestic economy were stationary.
However, often when people talk about "growth" in the market, what they really mean is "return". That is, how much does your investment earn for you. This isn't really the same thing as growth, but people often think of it that way, particularly in the saving phase of their investing career, when they are reinvesting their returns, and therefore their account balances are growing. It is possible to have a positive return, averaged across the market, even in a stationary economy. The reason why is that there are really only two things a firm can do with its net profits. One possibility is that it could invest it in growing the business. However, there is not much point in doing that in a stationary economy because by assumption no increase in aggregate consumption (and therefore, in the long run, aggregate production) are possible. Therefore, firms are left with only the second option, which is to pay them out to investors as dividends. Those dividends provide a return that is independent of economic growth.
Would the stock market still be a good investment in such an economy? Yes. Well, sort of. The rate of return from firms' dividend payouts will depend on investors' demand (in aggregate) for returns on their investments. Stock prices will rise or fall, causing returns to respectively fall or rise, to find that level. If your personal desire for returns is lower than the average across the investing public, then the stock market would look like a good investment. If your desired return is higher than the average, then it will look like a poor investment. The marginal investor will, of course be indifferent. The practical upshot of this is that the people who invest in the stock market in this scenario will be precisely the ones for whom the stock market is a good investment, given their personal propensity to save and desire for returns, and so forth.
Finally, you mentioned that in your scenario the GDP stagnation is due to declining population. I am less certain what this means for investment, but my first thought is that you would have a large retired population selling its investments to fund late-life consumption, and you would have a comparatively small (relative to history) working population buying those assets. This would lead to low asset prices, and therefore high rates of return. However, that's assuming that retirees need to sell assets to fund their retirement consumption. If the absolute returns on retirees' assets are large enough to fund their retirement consumption then you would wind up with relatively few sellers, resulting in high prices and therefore relatively low rates of return. It's not obvious to me which effect would dominate, and so it's hard to say whether or not the resulting returns would look attractive to the working-age population.