Market timing vs dollar-cost averaging
This is a strategy for changing the asset mix in your portfolio. Paid brokers positively love dollar-cost averaging; because it allows them to give exactly the same advice regardless of market conditions, and always be "right" and evade responsibility for market turns, even obvious ones.
I'm not 100% thrilled with it, though, because dollar-cost averaging tells you to completely ignore the obvious: we've been in a very long bull market, and it's time to start thinking about whether this is a bubble; interest rates are very low which means certain financial products are a very bad buy; etc.
However, this is not what your question is really about.
Managing investment mixes for different ages
You may have heard the term volatility, often confused with **risk*. Volatility reflects the deviation of how much stocks will go up or down in a given time-planning period. For instance, at a 30-year planning horizon, stocks are not very volatile at all - their growth and dividends can be relied on. That's how endowments work. And believe me, they do work!
However, as the planning horizon gets shorter, volatility becomes more certain and more extreme. At a 1-year planning horizon, anything can happen. Stocks can go up 80% or down 40%.
So what does this mean? If you have 30 years til retirement, the stock market is a sure thing. You don't need to think about that choice; anything else would be a mistake.
But at 15 years til retirement, volatility starts to appear. It will probably go up a lot. But it might only go up a little, or even slip a bit.
At 5 years, volatility is in full swing. It might triple and might backslide 30%.
You can't allow yourself to be wiped out near retirement
The last thing you want is to have a 43% market turndown just at the moment you need to spend the money. That's a bit extreme, since you presumably spend the money over years of activity, so there isn't a "moment" per se, and it will average out somewhat. But if your retirement-years-of-need happen to land in a market doldrum period, like 2007-10, you could get badly hurt.
Volatility and growth go hand in hand. The price you pay for long term growth is short term volatility.
So it's a very sensible strategy to start backing out of the market as you near retirement (or to be more precise, time of withdrawal). Typically this is done by altering your asset mix, to be a few percent less stocks every year and a few percent more "less volatility, but less growth" investments like bonds. As you are in your end years, you want to be mostly in bonds or low-volatility investments - that way you aren't left flat by a sudden downturn.
If you look at 401K "horizon funds" or "target-year funds", that is exactly what they do.
To revisit "timing the market", they don't, but you could if you are paying attention and are willing to accept the risk of potential un-captured gains. (that is to say, if you move out with the Dow at 16,000, and shortly after the Dow goes to 19,000, that's money you didn't win. The flipside is if the Dow fell to 12,000, that's money you didn't lose.