Of British-English origin, the phrases to have a foot in both camps and to have a foot in each camp mean to belong to, or to sympathise with, two opposite groups, factions, etc.
Here, the noun camp designates the supporters of a particular party or doctrine regarded collectively.
Because (with one exception only) all the earliest uses of the phrases that I have found occur in French contexts—sometimes in translations from French—I think that to have a foot in both camps and to have a foot in each camp are respectively calques of the French phrases avoir un pied dans les deux camps and avoir un pied dans chaque camp.
The earliest occurrence of avoir un pied dans chaque camp that I have found is from Le Courrier français (Paris, France) of Monday 14th March 1836:
En 1834, M. Janvier, élu par une majorité de coalition, se tenait sur la limite des deux oppositions. Il avait un pied dans chaque camp. Il écrivait aux journaux de la gauche : « Quoique nommé par les légitimistes, je suis avec vous ; » il disait aux journaux de la légitimité : « Je réclamerai l’amnistie pour vos partisans. »
In 1834, Mr Janvier, elected by a coalition majority, was standing on the boundary between the two opposing sides. He had a foot in each camp. He wrote to the newspapers of the left: “Although appointed by the legitimists, I am with you;” he said to the newspapers of legitimism: “I will demand an amnesty for your partisans.”
The earliest occurrence of avoir un pied dans les deux camps that I have found is from Le Constitutionnel, journal du commerce, politique et littéraire (Paris, France) of Thursday 23rd March 1843:
Il s’agit de savoir si quelques personnes doivent conserver le singulier privilège d’avoir un pied dans les deux camps, et de se faire valoir auprès de tout le monde.
It’s a question of knowing if some persons must keep the singular privilege of having a foot in both camps, and of promoting themselves to everybody.
These are the earliest occurrences of the English phrases to have a foot in both camps and to have a foot in each camp that I have found, in chronological order:
1-: From The Times (London, England) of Saturday 4th March 1854:
The Prussian Government still appears to be playing fast and loose, with one foot in each camp, and one finger in each scale. Troops have been ordered to the eastern frontier, but, at the same moment, Coblentz is prepared for war, as if the danger lay on the Rhine rather than the Baltic.
2-: From a correspondence from Paris, France, published in several British newspapers on Monday 1st August 1859—for example in The Express (London, England):
—The context is the Second Italian War of Independence, fought by the Second French Empire and the Savoyard Kingdom of Sardinia against the Austrian Empire in 1859:
An assertion of the Siècle that the Duchess of Parma 1, in order to have a foot in both camps, wrote conciliatory autograph letters both to the Emperor Francis Joseph 2 and the Emperor Napoleon 3 before the commencement of hostilities, is indignantly denied by her friends.
1 Louise Marie Thérèse d’Artois (1819-1864), Duchess (1849-1854), then Regent (1854-1859), of Parma.
2 Franz Joseph (1830-1916), Emperor of Austria from 1848 to 1916.
3 Napoléon III (Charles Louis Napoléon Bonaparte – 1808-1873), Emperor of France from 1852 to 1870.
3-: From a correspondence from Paris, France, published in The Express (London, England) of Wednesday 6th May 1863:
The Presse seeks a motive for the omission in the Moniteur of the Russian answer to the Austrian note; and it is, in point of fact, a curious thing that whereas the St. Petersburg Journal has already published all three despatches the French Government should think it advantageous, in any conceivable point of view, to keep back one, for the very few hours which now stand between it and universal publicity. The Presse observes that the suppressed despatch is the most interesting of the three, on account of the double and delicate situation of Austria, who has a foot in each camp, since she protests with England and France, and at the same time holds Cracow by virtue of the iniquitous partition of Poland, made by her jointly with Russia and Prussia.
4-: From a correspondence from Paris, France, published in The Daily News (London, England) of Tuesday 23rd July 1872:
The division list, showing a majority of 96 for M. Thiers on the principle of increased taxes on raw materials, is worth studying. While M. Gambetta, and such of his friends as he could influence, voted with the Government, I notice in the minority the following dozen names of Republicans who could not bring themselves to vote against their free-trade principles from political considerations:—MM. Louis Blanc, Taxile Delord, Jules Favre, Greppo, Laboulaye, Naquet, Ordinaire, Pascal Duprat, Scheurer Kestner, Schœlcher, Tirard, and Tolain. The Orleans Princes agreed not to agree upon the subject; and on the principle, I suppose, of having a foot in each camp, the Prince de Joinville voted for M. Thiers, and the Duc d’Aumale against him.
5-: From the translation of a speech given at Moulineaux, in Normandy, by the French magistrate and politician Edgar Raoul-Duval (1832-1887)—translation published in The Standard (London, England) of Thursday 22nd August 1872:
He awaited the issue of the struggle with a foot in each camp. Whichever way the battle terminated, there would be a place for him; for, although he took no ostensible part in the insurrection, which pillaged, burnt, and assassinated, he did not in any way disavow or condemn it.
6-: From Men of the Third Republic: M. Jules Simon, a biography of the French statesman and philosopher Jules Simon (1814-1896), published in The Montrose, Arbroath, and Brechin Review (Arbroath, Angus, Scotland) of Friday 7th February 1873:
M. Simon came back to France again, and in 1861 caused a new stir by some lectures at St Quentin and Verviers, intended to promote the creation of “cités ouvrières” (model lodging-houses). The Prefect of Police conveyed to him, through the medium of a common friend, that the Government could not allow any movement for the improvement of the working classes to be undertaken, unless the name of Napoleon were mentioned eulogistically in connection with it. M. Simon answered that 60,000 francs had been raised in one city and 240,000 francs in another on behalf of the model lodging-house movement without the co-operation of Napoleon’s name, and that he really could not see what that name had to do with the matter. He was told, in reply, that he had better take care of himself, and that the eye of the Rue de Jerusalem 4 would be upon him. From this moment friends who had a foot in both camps, Liberal and Cæsarial—MM. Duruy, Caro, and others—began to play the pumps of cajolery on Jules Simon. They tried to win him over.
4 La Préfecture de Police (the police headquarters) was located on rue de Jérusalem, in Paris, France.
7-: From a correspondence from Paris, France, published in Trewman’s Exeter Flying Post (Exeter, Devon, England) of Wednesday 28th October 1874:
Imperialism is an exception to being benefited by having two strings to its bow. It says to the Monarchists, “I am son of the Revolution, have killed my mother, have adopted hereditary monarchy and its accessories;” to the Republicans it makes the allocution, “I do not belong to the ancient regime, but to modern society, and advocate universal suffrage, provided I be entrusted with its manipulation.” Thus, Bonapartism endeavours to keep a foot in both camps, to run with the hounds, and hold with the hare.