In a war, the country or militia needs lots of money to continue to fight because soldiers must be paid to fight since they are not working a job. They also need money for equipment like guns, tanks and ammunition. These countries and militia usually receive money from their friendly neighboring countries that support them. With ISIS, they have been fighting for almost twenty years. That required a lot of money. However, ISIS was fighting in an area that has a lot of oil. So, these countries had money to supply them.
At one time Saudi Arabia, Kuwait and other Middle Eastern countries were giving money to ISIS until recently when laws required certain countries like Saudi Arabia to stop giving ISIS money.