# Why do time series need to be stationary for computing cross-correlation?

Imagine I want to find the cross correlation between two time series. I don't actually have think stock data or production/sales data, etc. Why does the data need to be stationary before computing cross correlation. What are the implications if I do not detrend the time series to make it stationary, but still compute the cross correlation (in a statistical software such as R)?

And this is an added question, so no worries if you do not answer, but imagine I use tools (such as the stl() function in R) to detrend and remove seasonality from the time series, and the time series is still not stationary (there are occasional spikes in the data). What can be done about this, if anything, if my final goal is to compute cross correlation between two time series?