Why correlation is not associative in the context of image processing? I can see most of the places it says "convolution is associative, while correlation, in general, is not". 

Denote $*$ convolution operator, let's say you have an image $f$, which you need to convolve with $g$ and then with $h$ :
$$f∗g∗h=f∗(g∗h)$$

But when I see the difference between convolution and correlation, correlation is equal to convolution but after flipping the kernel or window. 

Can somebody explain with an example why correlation is not associative?
Subtraction is also not associative: (a-b)-c does not equal a-(b-c) in general. The order of the flipping of the sign matters, just like it does for the flipping of the kernel.