It seems quite plausible that Elsa is descended from someone who was cursed by ice magic. That power may have then transferred down the family line.
As you can see from the image below, the King's library has a book detailing the risks of being hit by ice powers. In this book we see a picture of a man being cured by trolls. The runes next to the picture state that his condition was caused by being...
"...to stone brought forth (by) powers of the moon sky"
presumably in much the same way that Rapunzel's powers relate to a drop of sunlight falling from the sky.
Given the fine clothes he's wearing and the royal crest on his tunic, it's quite possible that he is of noble birth and hence, an ancestor of Elsa's. Assuming some of the residual 'ice magic' was left in this man's system after he was cured it would explain why one of his descendants was born with those same ice powers.
Screenwriter Jennifer Lee specifically spoke to this point in an interview with Scriptnotes. The origins of Elsa's powers (planetary alignment, predestination, etc) were intentionally obscured in order to simplify the story.
In a nutshell, she has powers because the plotline requires her to have powers.
Jennifer: And that there’s a connection between them, but yet it’s not in your face, but it’s just something that… — Because what I
always loved about, particularly Pixar films for me, was that
everything just added up. And everything had a special little, “Oh my
god, oh my god, wait, and that, and that!” And it was my favorite
thing and we wanted to make kind of every time we had a scene trying
to say what is that that’s maximum, why is it here. If there’s
anything extraneous we got to get rid of it.
But yet adding all that flavor, so that’s why. But to move onto Elsa,
it was an exhausting process coming to the simplicity of her powers. At times we had a narration by a troll, who used to have a Brooklyn
accent for no reason other than I miss Brooklyn. You know, no reason.
But, we had this whole explanation like when Saturn is in this
alignment with such-and-such on the thousandth year a child will be
born and blah, blah, blah. And then –
John: Ultimately you almost throw it away with one line. So, the
line is just like, “Was she born with the powers or was she cursed?.
And it’s born with it and that’s the last piece of it.
Aline: It’s so great.
Jennifer: And that’s it. But I think part of what it was is if anything about us felt like it was like, “Oh, god, like okay, we have
to say this,” then we didn’t want to say it. And then also we found
the more you explained the more questions you had about magic and the rules. It was like, argh. You know?