The Reformation was among other things a very complicated political affair. The pope was not happen to see such a powerful Roman Emperor; the emperor was determined to make himself king in Germany and not just a figure head. He was also king of Spain, which is what brought him into Italy, effectively ending France’s role there for awhile, and threatening the pope’s control of the papal states. The Pope and emperor were, of course, allies against the Turkish Sultan who was invading Germany; the Luther princes somewhat less ardent in this, were not eager to send money to Rome to use against the Turk. The king of France, a Catholic, was a sometime ally of the Turk. Then we have England... In any case, Luther was largely indifferent to all this stuff.
The 30 years war was a rather odd time in history. By the end, the Pope was more afraid of Catholic France than Protestant Germany, and actually helped Gustav Adolphus some (who had also been paid by France before). At least one history of the war that I have read says that it was really a fight between three Catholic powers, Spain and the HRE, France, and the Papal States, that was fought in the Protestant estates.
Hence you have the Catholic Holy Roman Emperor storming Rome with an army of Lutheran/Calvinist mercs. Who a few years past had been fighting against said Emperor.