I think that on her mother's side, the oldest in the family gets the ice powers from their mother. Elsa's mother inherited her ice powers from her mother, then lost her ice powers while giving birth to Elsa. I'm thinking that's where she got her ice powers.
Pabbie asks if Elsa was born with powers or was cursed, which means that there are people who are born with powers. Elsa's powers are a metaphor for the things we're already born with, can't get rid of and have to live the whole live with, like physical deformations or genetic diseases. Trying to figure out where they came from would only make the film's story unnecessarily confusing.
My strong guess is that the Evil Troll using his malevolent powers, blasted ice in the queen's belly when she was pregnant of Elsa. He was trying to kill the unborn baby by causing the queen an abortion. But he accidently gave Elsa the powers instead. The Troll, knew it would still cause her trouble though and he left, grinning. Elsa's parents were very worried if their new daughter was dead from inside her mom's womb, so when the queen finally gave birth to the baby Elsa, they realized she was okay, but discovered of her new abilitites afterwards.
That is a good reference to the original book, when he accidently dropped the cursed magic mirror to the ground and broke it into a thousand pieces and scattered them all over the world. He left grinningly afterwards leaving the mirror frame behind, knowing that it would cause the world chaos
Or strange secret ways like if an ancestor had a animal friends who were used to ice being year round as well as used to their own ice powers
Dragon who blows ice or knows how to swim under ice / even a fire dragon who broke ice
Arctic animals who visited the ancestor with the same power wolf, fox, polar bear, puffins, seals
A walrus offering an ancestor of Elsa's a fish with a secret potion???
A Sorceress who had a Wolverine trick an ancestor of Elsa's?
Unicorns, Russian and Gaelic and even the Beauty Unicorn who's too bright to look at bright enough to blind you quickly, or if it stayed near the dragon it could be a ember unicorn whose mane is firey, or a jewel unicorn who ate the crystals after they were turned to something like diamonds
A Pheonix's wish for one of Elsa's ancestors
A gryphon's secret involvements with an ancestor of Elsa's that started witha tapestry????????