Years and years ago, Odin learned about the Infinity Stones through his father, Bor, who was responsible for taking the Reality Stone from the Dark Elves. After his death and Odin's subsequent rise to power, he (with Hela at his side) began conquering all the realms in order to locate and claim the Stones. Odin found the Space Stone first and this allowed Odin and his armies to travel between realms and conquer them very quickly. During this he commissioned Nidavellir to create a device which would allow him to control all the Stones at will: the Infinity Gauntlet. They created the mould for it and made one casting as a test fit for Odin, complete with fake Stones to give Odin an idea of the grandeur of the finished Gauntlet.
However, at about this time he discovered the whereabouts of the Soul Stone and what was required of him to get it: He'd have to sacrifice that which he loved the most, which was Hela. He found he couldn't do it and in that moment Odin stopped being a conquerer and started being a king. Hela didn't understand this change of heart; she knew what the Infinity Stones were because Odin specifically told her that's why they were conquering all the realms, and Hela believed in that power more than anything else. So she and Odin fought; Odin won and that's when he imprisoned her in Hell. Odin put the fake Gauntlet in his treasure room as a reminder of both what he'd done and what he'd lost, and swore that he would protect all that he had conquered. Thus he became Odin Allfather, Protector of the Nine Realms. Nidavellir decomissioned the Gauntlet mould and Odin hid the Space Stone on Midgard. Odin almost definitely knew where the Reality Stone was because Odin's father had it at one time. If this theory is true then he definitely knew where the Soul Stone was, he might have known where the Power Stone was, he probably didn't know the Time Stone was also already on Midgard (otherwise he likely wouldn't have risked two Infinity Stones in the same place), and he almost definitely didn't know where the Mind Stone was.
When Thanos arrived on the scene and went to Nidavellir to have them forge a control for the Stones, they used their previous knowledge from Odin's Gauntlet to make one for Thanos.
If this theory were true then it explains how and why Odin was previously a conquerer and why he changed; why there's a fake Infinity Gauntlet in Odin's treasure room; how Hela knows it's fake; how Hela knows what the Tesseract is ("That's not bad," she says while giving a small pause in front of it); why Odin changed from conqueror to king; why Odin and Hela fought; and why Thanos' Gauntlet is basically the same as the fake Gauntlet at Asgard.
Odin may have used the Space Stone to banish Hela to Hell, which may be considered unnatural since Hell isn't supposed to be for living beings. That being the case, Odin "tampered with natural law" and the bill came due by way of the Ragnarok prophecy. The destruction of Asgard may have been the universe's way of balancing itself out.