They were made by Varda after the Two Trees were flourishing in Valinor for some time. All the inhabitants of the sacred realm drew light and refreshment from them.
Later, when Melkor and Ungoliant descended upon the trees and destroyed them, Ungoliant drank the wells dry. And after their light was gone there was none left in Valinor save for in the Silmarils.
It's most likely a reference to the well of Mimir, Mímisbrunnr, from Norse mythology that Odin would consult for knowledge, located at the roots of the world tree. It is where he sacrificed his eye into the well in exchange for deeper knowledge.