What does ま mean in this sentence?
いつのまに[降]{ふ}り[止]{や}んだ
Bonus question: What is the function of の in this sentence?
いつの[間]{ま}に is a set phrase meaning literally "during what time", generally questioning the timeframe during which something happened.
いつのまに降り止んだ
The speaker is expressing surprise at the rain having stopped while they were unaware of it. "[During what time/when] did it stop raining?!" Alternatively, if it's narration, it could also say "Before [we] knew it, it had stopped raining."
The phrase can also be used differently:
A: Did you do [XYZ]?
B: いつの[間]{ま}に!?
Here the speaker is exclaiming exasperation at not having had time to do [XYZ]. "When exactly did you expect me to do this?!" or "You should be aware that I could not possibly have had time to do this."
ま in this case is 間 meaning 'duration' or 'while' or 'interval'. You've probably heard it before and just don't realise it. Example, 間もなく(まもなく)電車が到着します.
Regarding いつの間に, think of it as 'at some point in time', or 'at some moment or another'. So your sentence means 'at some point (when exactly we're unsure) it stopped raining'.