By Miss Sarah Joseph Hale, Boston, and published Sep 1830 in a periodical called Juvenile Miscellany, and later in Poems For Our Children. Designed for families, Sabbath Schools and Infant Schools. The rhymes have been claimed by various authors, her son Horatio Hale was one of them. A Mrs Taylor nee Mary Sawyer of Sudbury Massachusetts made this claim, believing herself to be the original Mary.
Two hundred documents were collected by Henry Ford in an attempt to prove this claim, he also restored the old school house at Sudbury as a memorial. This claim was refuted by Mrs Hale in a letter written just before her death and by her son shortly after (Boston Transcript 10 Apr 1889).
The Welsh claim the Mary Hughes nee Thomas was Mrs Hale's original Mary in 1847 and this appears on her tombstone. But this claim was precluded by the date of the first publication. Many orphaned animals are fostered by children and they develop affection for each other, the incident of such an adopted lamb following a little girl to school is quite understandable and must have happened many times in the past.