The $f(R, T)$ gravity as a modified theory of gravity is considered to study the Friedmann–Robertson–Walker (FRW) universe. We consider the case $f(R,T)=f_1(R)+2f_2(T)$, where $f_1(R)$ is an arbitrary function of Ricci scalar and $f_2(T)$ is an arbitrary function of the trace of the energy-momentum tensor. Using the usual field equations, the conservation equation does not hold. However, we can redefine the field equations to satisfy the conservation equation. In this paper, we show that the FRW universe, as a closed system, may have a conserved 4-momentum if we assume an interaction between matter and the dark energy component coming from $f_2(T)$. The rate of the energy transfer between the ordinary matter and the dark energy component induced by $f_2(T)$ is obtained. Then, we derive the first law of thermodynamics by using the field equations and the standard entropy-area law on the apparent horizon. It is shown that there is an equality between the Friedmann equation and the first law of thermodynamics. One can also find an equilibrium description of thermodynamics in $f(R, T)$ gravity. In addition, we investigate the validity of the generalized second law of thermodynamics. It is shown that the generalized second law of thermodynamics is always satisfied in the FRW universe.