The same question was asked and answered on our sister site Movies &TV. I am using the answers there to inspire my own here.
The answer provides evidence that the lake on which the scene takes places seems to have old structures there. This would indicate a previous settlement, most likely by the Night's Watch during the construction of the Wall. Iron forging is only known south of the wall, and therefore makes it unlikely to be a Free Folk settlement. The purpose of this settlement was possibly to be an ice farm during the construction of the wall. If chains were used (and subsequently abandoned) this gives us one option for the Army of the Dead to obtain the chains.
A second option is that the chains came from Hardhome
Hardhome sits on a sheltered bay and has natural harbour deep enough for the biggest ships afloat. Wood and stone are plentiful near there. The waters teem with fish, and there are colonies of seals and sea cows close at hand. A great cliff looms above the settlement, pocked with cave mouths.
Hardhome was close to becoming the only true town north of the Wall.
If Hardhome was supporting trade and large ship, it is likely they would have chains at the docks for anchors, cargo loading, or other maritime activities. Since the Army of the Dead has recently sacked that settlement, they may have also found chains there.
One method I generally discount is that the chain was made from ice. While it is known the White Walkers have certain ice magic to create their swords and spears, these weapons are rough looking and blueish in color. The chain does not share these qualities.
Now how they got the chains on... I think it is as simple as the dead cannot swim properly and sink. However, since they are dead already they can still move. Basically the same as what the crew of the Black Pearl did in Pirates of Caribbean.