No, spray foam will not rot your roof. However, if it is not installed properly, you could allow moisture in, which will then rot a roof. When water permeates the foam, it will degrade over time. Correct installation is key.