You can think different paths from thermal equilibrium between two bodies. In the multiple possibilities there is at least one path that is reversible, which Ill try to describe here, but Im sure you can also find in textbooks. Let's assume you take two bodies with different temperatures $T_1<T_2$ lying the equilibrium temperature in-between.
Then one reversible path of thermal equilibrium is to think of an 'infinite' (or a very large number of it, physically speaking) number of thermal reservoirs with temperatures going from $T_1$ to $T_2$. Now, if you heat up the first body by making thermal contact of it with a thermal reservoir at $T_1+ \delta T$ (pretty much being this process reversible with the contact of the same body with another thermal reservoir at $T_1$), the entropy varies as
$\delta S_1= \int_{T_1}^{T_1 +\delta T} \frac{dQ}{T} = m_1c_1 \ln \frac{T_1 + \delta T}{T_1}$.
The same process (but inverse) can be done with body two,
$\delta S_2= \int_{T_2}^{T_2 -\delta T} \frac{dQ}{T} = m_2c_2 \ln \frac{T_2 - \delta T}{T_2}$.
By repeating the procedure, the thermal equilibrium will be achieved at some point with temperature $T_e$, such that $T_1 < T_e < T_2$.
Now, for simplicity let us suppose $m_1c_1=m_2c_2$, such that, the total entropy variation of thermal equilibrium is
$\Delta S_1+\Delta S_2= mc \ln \frac{T_e^2 }{T_1 T_2}$.
It is easy to prove that the total variation will be a maximum when $T_e= \frac{T_1+T_2}{2}$.
In short: the thermal equilibrium is the state of maximal entropy of the system.
(This can be demonstrated also when $m_1c_ \neq m_2c_2$ with a bit more of algebra...).