Melsheimer studied at the university in Helmstedt from 1772 to 1776 before becoming chaplain to the Duke of Brunswick’s Dragoons Regiment. With this regiment he arrived in Canada in 1776 to fight alongside British troops in the American Revolutionary War. He was taken prisoner by the American army on August 16, 1777 following their victory at the Battle of Bennington and remained in prison for fourteen months. After being released on parole, he resigned from his office of chaplain and began to preach in Lancaster County, Pennsylvania.
In May 1779, he accepted a call as pastor of five Lutheran congregations in Dauphin County. He married Maria Agnes Man on June 3, 1779. In 1784, he moved to Manheim, where he was ordained to the ministry by the Lutheran ministerium of Pennsylvania in 1785, and was pastor at New Holland from 1786 until 1789. He was pastor at Hanover from 1790 until 1814. His service exerted a strong influence on the German colonists of Pennsylvania, and his entomological interests were said to “furnish some of his parishioners with mild amusement”.
His insect collection, inherited and increased by his second son Frederick Ernst Melsheimer and his son’s friend Daniel Ziegler, was eventually purchased by Harvard University and formed the basis for what is now the largest university-owned collection of insects in the United States. His Catalogue was intended to be a three volume work, but illness prevented publication of more than the first volume, in 1806.
Melsheimer was also interested in mineralogy and astronomy, and served as Professor of Languages at the recently founded Franklin College in 1787. He died in 1814 of lung disease. Two of his eleven children also devoted themselves to natural history: John Frederick Melsheimer (1780-1829) and Frederick Ernst Melsheimer (1782-1873).