The reference to Bourbaki in the short story's first sentence makes clear that the story is set during the Franco-Prussian War of 1870–1871. More specifically, the story is set after the defeat of general Charles Bourbaki's army at the Battle of the Lizaine (or Battle of Héricourt), which was fought on 15 January to 17 January 1871.
The Army of the East (Armée de l'Est), led by Bourbaki, had set out to lift the siege of Belfort, which had begun on 3 November 1870, and won the Battle of Villersexel (9 January 1871). However, the Army of the East had been rather hastily put together and had serious supply-chain issues, which is why they didn't manage to exploit the victory at Villersexel. On 12 January, Bourbaki was informed that general von Manteuffel's army was approaching from the west (Bremm: 249), and after deliberating which army to fight first (von Manteuffel in the west or von Werder in the east), he decided to attempt to break through to Belfort in the east as quickly as possible.
Even though the Army of the East outnumbered the Prussians on the other side of the Lizaine river roughly three to one, it did not manage to break through, so after three days of battle without progress Bourbaki ordered a retreat towards Besançon, further south. However, von Manteuffel's army had progressed very quickly; they reached Gray in the Haute-Saône on 19 January and the Doubs on 21 January. Bourbaki changed direction to the east, while von Werder's army had crossed the Lizaine river and were pursuing him from the north. Large parts of the Army of the East surrendered to the Prussians (Bremm: 251).
On 25 January, Bourbaki decided to lead what remained of his army to Pontarlier, close to the Swiss border, from which he hoped to avoid encirclement by using the road to Lons-le-Saunier (Bremm: 251-252). After a failed suicide attempt on 26 January, Bourbaki was replaced as commander-in-chief by general Justin Clinchant. After a failed attempt to get over the mountain passes at Les Planches and Saint Laurent, another part of the Army of the East surrendered. By that time, France and the Germans had signed an armistice on 26 January, which had come into force on 28 January. However, whereas von Manteuffel received the full text of the armistice text, general Clinchant did not receive the part of the text that said that the territory between Dijon and the Jura was excluded from the armistice (Bremm: 252). For Clinchant, there were only two choices: either surrender to the Germans or internment in Switzerland. On 31 January, Clinchant contacted the Swiss authorities. On the next day, around 80.000 French soldiers crossed the Swiss border near Les Verrières. The Convention of Verrières, signed between general Clinchant and the Swiss general Herzog, defined the terms of the internment. The Treaty of Frankfurt, signed on 10 May 1871, ended the Franco-Prussian War.
With this background information, we can answer many of the questions listed above.
- "To do so they cross apparently into France ...". Yes, they cross the border back into France, which is still partly occupied by the Germans. For this, they do indeed first pass the Swiss soldiers on the border ("Un officier suisse eut l'air de regarder ...") and then the German ones ("Les lignes prussiennes étaient fort mal gardées, ...").
- The "prisoners" are the French soldiers interned in Switzerland. The French text uses the term "prisonniers", which has the same meaning.
- Manteuffel refers to Generalfeldmarschall Edwin von Manteuffel, who was closing in on the Army of the East coming from the west (see above). The "treaty" that one of the French soldiers mentions, refers to the Convention of Verrières signed by Clinchant and Herzog. Neither Bremm's book on the Franco-Prussian War nor Charles de Mazade's articles mention what von Manteuffel thought of the treaty, nor whether any French soldiers clandestinely returned to France.
- "only a trap laid for the Prussians": This passage shows that the captain is not in touch with reality. This had been shown earlier by disregard for the treaty between Clinchant and Herzog and by his words, "Nous nous jetterons au cœur de l'armée prussienne, s'il le faut, (...).": "We'll thrown ourselves into the heart/centre of the Prussian army if necessary". After the Treaty of Franfurt (May 1871) the German troups gradually left France, except that Alsace (except Belfort) and Lorraine were ceded to the German empire. By 16 September 1871, the German occupation had ended (see map on 124-126 in Epkenhans's book).
P.S. The question describes the story's protagonists as "francs-tireurs". However, the origin of the francs-tireurs was the type of association know as "société de tir" in French and Schützenverein in German. The war of the francs-tireurs was (in part) a reponse to Léon Gambetta's call for a "guerre à outrance". Even in the late 19th century, it was not clear whether the "francs-tireurs" were combattants as defined by international law (Epkenhans: 96-97). The captain and his handful of soldiers fight like francs-tireurs even though that is legally not what they are. Epkenhans points out that there were fewer rules in the war fought by or against francs-tireurs than in the war between the regular armies. Richepin's story seems to reflect this reality.
- Bremm, Klaus-Jürgen: 70/71. Preußens Triump über Frankreich und die Folgen. Darmstadt: Wissenschaftliche Buchgesellschaft, 2019.
- Epkenhans, Michael: Der Deutsch-Französische Krieg 1870/1871. Stuttgart: Reclam, 2020.
- de Mazade, Charles: La Guerre de France en 1870-71. Revue des Deux Mondes, 2e période, 1872-1874.