Well, moss can grow on rocks. The surface of your roof is similar to this. Additionally they need humidity. Once a bit of dust, dirt or leaves has collected on top of your roof, they capture humidity in form of rain and allow moss to grow. From that point on the moss stores collects rain itself.