Delay tolerant networks (DTNs) can be composed of multiple heterogeneous groups (i.e., communities) of nodes. The nodes from these communities can cooperate with each other in order to carry and forward data packets so that the performance (e.g., delay) can be improved. However, this cooperation will incur additional cost on the nodes. In this paper, we first develop an analytical model to investigate the performance gain from cooperation of multiple communities in a DTN. Then, we propose a coalitional game model for analyzing the cooperation decisions of multiple rational communities based on the tradeoff between performance gains and associated costs. As a solution to the proposed game, we determine the stable coalitional structure, i.e., the structure where no community can improve its payoff by changing its cooperation decisions. The proposed analytical and game models will be useful for the performance and cost optimization of multi-community DTNs.