I once asked this question to an ultra-Orthodox Jewish man, since it is mainly the ultra-Orthodox who wear long black coats. He responded, “We do it because our fathers did.” That is the power of tradition in Judaism! He also stated that this would be in keeping with biblical practice, where people wore long robes rather than shorts, so this is also a matter of modesty, although religious Jews would not look to the Bible in specific support of wearing long black coats.
On another level, the particular type of dress in question—the specific kind of long black coat—is of relatively recent origin and is based on traditional European Jewish custom. In short, the style of dress that was common in certain traditional Jewish communities in Eastern Europe several centuries ago became fixed as time went on, again, a testament to the power of custom in Judaism. (It is even said that “the custom of the people is law.”) In other words, if a community adopts a particular practice—whether in dress or in family life or in study habits—and that practice becomes customary to the point that “everyone is doing it,” and if that practice then continues through the generations (with rabbinic approval, of course), then it becomes somewhat sacrosanct, not easily changed. Similar to this is the custom of Mennonite women who wear a certain type of head covering or the custom of Amish men to grow their beards but shave their mustaches.
Related to the power of custom—especially in Judaism—is the concept of the “good old days,” meaning that the former generations were considered to be on a higher spiritual plane than the succeeding generations, and in certain eras, some of the Jewish communities were considered to be especially holy and devoted. Their practices, then, would be adhered to even more zealously, and that is exactly what happened with the customary dress of these Eastern European communities—the long coats, certain types of hats and even knickers. That is to say, some of this was not even Jewish in origin as much as it was the customary dress of the society at large. But so highly esteemed were these Jewish communities by the succeeding generations that even their dress was copied, to this very day. In fact, in some ultra-Orthodox communities in Israel, such as Mea Shearim in Jerusalem, the men can be identified by the outfits they wear, outfits associated with specific Eastern European Jewish communities. Thus, some of them still wear knickers and white coats; others wear knickers with black coats; others wear black coats and regular pants.
I once visited a yeshiva (a learning center for Orthodox rabbinic study) in Lakewood, New Jersey, at the invitation of an ultra-Orthodox Jewish friend of mine who studies there. (This yeshiva has roughly four thousand men studying there daily, making it the world’s largest yeshiva.) Every man there wore black pants and a white shirt—without exception, and without it being a stated requirement for entry—and upon entering the yeshiva, my friend hung up his (black) hat and (black) coat, which became one of many (to my eyes) identical hats and coats, although my friend assured me that his was readily distinguishable to him.
In any case, there is no biblical basis for the custom of wearing long black coats, nor is such a basis claimed for the custom.