The Islamic State and the Taliban have been up to their loongies [skivvies] in blood over territory in several provinces. The long-running Taliban insurgency has been trying to stamp out ISIS, a smaller, newer rival, and while this was going on, U.S.-led coalition forces took advantage of the conflict. They fought the militants on multiple fronts in order to push them back and reclaim territory they once held.
Realizing they were getting it from all sides, both ISIS and the Taliban made local deals to stop fighting each other and start fighting the government. Now ISIS was able to focus on fighting U.S.-backed Afghan forces in Nangarhar province, shift north into Kunar province, thus establish a new foothold in a longtime Taliban and Al Qaeda stronghold.
It's nice to know that two Islamic groups who once hated each other, can now be friends and work together to kill us. If we can only get them all in one place, well that would be heavenly for them, if you know what I mean.