Although there is already an accepted answer, I'll provide a different point of view here.

It is important to keep in mind that the imaginary time is periodic, which means fields satisfy periodic(or anti-periodic) boundary conditions (the reason is because we use imaginary time path integral to represent the partition function, which is $\mathrm{Tr}\, e^{-\beta H}$). Therefore, the correlation functions also obey the same kind of periodic conditions under the shift $\tau\rightarrow \tau+\beta$, which is why the Matsubara frequencies are $\frac{2\pi n}{\beta}$ for $n\in\mathbb{Z}$ for bosonic fields, and $\frac{(2n+1)\pi}{\beta}$ for fermionic fields. So if $|\tau_A-\tau_B|$ is larger than $\beta$, all you need to do is to fold it back by adding or subtracting several $\beta$'s, just as one would do to any periodic functions.