People have probably always put something on their bread; brown bread in particular is pretty unsavory if eaten dry (that's one of the reasons that working class people give for eating white bread, since they could not always afford various moisteners to go with their bread). In Britain and much of the United States, until 20th-century industrial baking and slicing, making sandwiches as we understand them was probably limited specifically to people buying food to take away and eat on the go.
The Earl of Sandwich famously invented the dish bearing his name in the 18th century by putting meat between two pieces of bread so that he could continue gambling. Whether that story is true or not is sort of beside the point, because--at least in Britain and Ireland--the majority of bread consumed in those countries came in loaves that were fairly large, the 4 lb. "quartern" loaf being that standard article of trade. These loaves usually had hard crusts, and were round, with top and bottom sections (like this). These don't lend themselves to the sandwich particularly well, and indeed in the many surveys of social conditions and diets that reformers, Poor Law guardians, physicians, and journalists carried out in the late 19th and early 20th centuries, I have found exactly zero references to "sandwiches" as such. The rural and industrial working classes--at least 85% of the population of the United Kingdom--ate primarily bread, up to and beyond a pound per day for an adult male in heavy work, but simply do not mention eating things in this manner. They didn't eat them dry; typically, they ate bread with "drippings" from cooking pork or beef, or with butter. They'll also mention having bread and cheese, but do not call them sandwiches and make no mention of putting the items together in sandwich fashion.
Still, there are some further bits of evidence we might consider. Henry Mayhew's London Labour and the London Poor, published in 1851, describes street vendors who sold ham sandwiches and--particularly in the breakfast trade--rolls that were so shaped that a cooked egg could be nested inside. These kinds of take away meals were commonly sold by vendors who lined the main thoroughfares in cities and towns and who offered coffee and tea as accompaniments. Further, Emile Zola's 1884 novel Germinal, describes coal miners in the 1860s as carrying "briquets," slices of bread with butter put together into a "brick" and carried by the miners under their coats as they made their way to work in the morning. I don't know if that counts as a "sandwich"--these miners were too poor to put much else on their bread--but it reinforces the notion that the sandwich was a particularly portable meal.
The invention of industrial, pan-baked and automatically sliced bread by the 1920s made available products that were far more naturally suited to sandwiches, and it happened at roughly the same time that bread was being eclipsed by other foods--more meat as much as anything else--as the foundation of diets, so that by the second half of the twentieth century, bread was no long considered a meal in itself. It's after this point that bread becomes more specifically linked to sandwiches, since those become standard, widespread take away meals like lunches.
If you look at art, you can find some genre paintings of medieval/Renaissance peasants or gamblers in taverns just hacking chunks off a big loaf. However, if you look in Rickart's The Babees' Book (a collection of late medieval/Ren etiquette books done into modern English) you will find that one of your jobs when you serve at table is to take the loaf and cut off all the crust, to make it squared off like our sandwich loaves. Then you slice it to serve. The hard top crust might be sliced to use as a rusk dipped in the soup, but basically the crusts all went in the alms basket.
Also, bakers made many sizes and shapes of loaves. There were regulations for them all.
In older cultures, the middle and upper classes didn't flinch at what we would consider "wasting food." They didn't eat the crusts. It's like when they would make a pie, the crust was there as a baking pan: the contents were often served out of it with a spoon, and that hard tasteless paste, barely shorted (and maybe not shorted at all), would go to the beggars or the dogs. (I've cooked authentic historical pies, and the crusts are horrible.)
Now, as to sandwiches: they were popular as an informal food in the 1800s, long before industrial slicing ("the greatest thing since sliced bread!")(if you have a chance to tour a bread factory, do it; the aroma alone is worth it).
Again, they did not manipulate bread like we do. For years I baked all my family's bread, handmade loaves of pain ordinaire (water, flour, yeast, salt, and no shortening), and a fresh loaf can only be sliced thickly, like an inch/25mm. But if you wait a day, you can get it down to a quarter of that, and the bread is by no means stale if you left the crust intact. Thus, sandwiches used to specify day-old bread if you weren't feeding field hands. (In any case, even into the 20th C, yeasty gases in fresh bread might be considered unhealthy, especially for athletes.) Also, one trick I learned from old cookbooks was to make one thin slice carefully, apply the filling to the cut end, put the slice back on, and it made cutting the second slice thin much easier. If they still couldn't get the slices thin enough, they would lightly apply a rolling pin, which works with day-old, though fresh bread turns to paste if you roll it.
So in the classic Regency heyday of the Wednesday subscription balls at Almack's Assembly Rooms, 1814-1820, one of the known refreshments were little sandwiches of day-old bread and butter. They were dainty enough for the Lady Patronesses.
Also, by this time metal pans for smaller, tidier loaves were becoming common in private kitchens, if not at the bakers'.
Going into my old cookbooks, we turn to my favorite of 1817, William Kitchiner's *Apicius redivivus : or, The cook's oracle: wherein especially the art of composing soups, sauces, and flavouring essences is made so clear and easy ... being six hundred receipts, the result of actual experiments instituted in the kitchen of a physician, for the purpose of composing a culinary code for the rational epicure .. *. He actually gives measurements, so you can cook from the recipes without "do thereto with flour until it is enough." He does not give recipes for sandwiches but twice. But they are there. The cookbook kept being reprinted into the middle of the century.
I didn't want to spend half my weekend on this, going cookbook by cookbook, so I went to Internet Archive and looked for when cookbooks devoted to sandwiches turn up. There is a big cluster c. 1905-1916, but the earliest are [Sandwiches by Artemus Ward; 1870] (https://archive.org/details/cihm_68420) and is Beverages and sandwiches for your husband's friends by Mrs. Alexander Orr Bradley; 1893.
So with what we would find in the general cookbooks (I've seen them at other times), I think we can say that sandwiches were popular as informal food throughout the 1800s, until at the start of the 20th C they become semi-formal food, with the likes of [Recherché side dishes for breakfast, luncheon, dinner and supper, comprising the newest hors-d'oeuvre, savouries, sandwiches & salads, oriential dishes, etc. by Charles Herman Senn, & James B. Herndon, Jr.; 1901] (https://archive.org/details/cu31924001688732) or [Light entertaining; a book of dainty recipes for special occasions by Helena Judson, ed ; 1910] (https://archive.org/details/lightentertainin00juds) which has plenty of them. They do come to rule at luncheon, along with egg dishes, and plenty of sit-down and buffet meals match up salad and sandwiches.
edit: As an habitual brown-bagger, I downloaded all those sandwich cookbooks: reading and drooling.
edit: from Mrs. Bradley:
It is imperative that the bread should be a day old and close grained without air-holes; that the slices should be cut not thicker than one-eighth of an inch; that each slice should be evenly and thinly spread with butter or mayonnaise as may be required, before cutting from the loaf.
edit: I thought I knew the name Artemus Ward, but it wasn't from cookery. He's a humor writer, but I think the title of the book establishes that the dish was well known. Mea culpa.
edit: Found sandwiches in 1861's The Book of Household Management by Mrs. Isabella Mary Beeton, 1836-1865. Should have known that if people ate it, Mrs. Beeton would have it. Meat sandwiches are kind of assumed anyone can put together, but dessert sandwiches of pastry or cake and preserves get recipe coverage, and appear in third courses.