Teeth are assumed to have evolved either from ectoderm denticles (scales, much like those on the skin of sharks) that folded and integrated into the mouth (called the "outside–in" theory), or from endoderm pharyngeal teeth (primarily formed in the pharynx of jawless vertebrates) (the "inside–out" theory). In addition, there is another theory stating that neural crest gene regulatory network, and neural crest-derived ectomesenchyme are the key to generate teeth (with any epithelium, either ectoderm or endoderm).
The genes governing tooth development in mammals are homologous to those involved in the development of fish scales. Study of a tooth plate of a fossil of the extinct fish Romundina stellina showed that the teeth and scales were made of the same tissues, also found in mammal teeth, lending support to the theory that teeth evolved as a modification of scales.
Read more, here.