It is very difficult to exit stocks completely and then re-enter in a recession. Stocks are forward-looking indicators, and most likely at the time you realize we are in a recession the bulk of the losses have happened.
You can make several moves that better position you for a potential downturn.