For two-phase flow in porous media, the natural medium heterogeneity necessarily gives rise to capillary nonequilibrium effects. The relaxation to the equilibrium is a slow process which should be introduced in macroscopic flow models. Many nonequilibrium models are based on a phenomenological approach. At the same time there exists a rigorous mathematical way to develop the nonequilibrium equations. Its formalism, developed by Bourgeat and Panfilov [Computational Geosciences 2, 191 (1998)], is based on the homogenization of the microscale flow equations over medium heterogeneities. In contrast with the mentioned paper, in which the case of a sufficiently fast relaxation was analyzed, we consider the case of long relaxation, which leads to the appearance of long-term memory on the macroscale. Due to coupling between the nonlinearity and nonlocality in time, the macroscopic model remains, however, incompletely homogenized, in the general case. At the same time, frequently only the relationship for the nonequilibrium capillary pressure is of interest for applications. In the present paper, we obtain such an exact relationship in two different independent forms for the case of long-term memory. This relationship is more general than that obtained by Bourgeat and Panfilov. In addition, we prove the comparison theorem which determines the upper and lower bounds for the macroscopic model. These bounds represent linear flow models, which are completely homogenized. The results obtained are illustrated by numerical simulations.