Season 2, Jack is forced to work with Nina Myers, the woman who killed his wife, in order to find information on the season's terrorist threat. Likewise, in season 6, Jack teams up with the previous season's Big BadCharles Logan to investigate a corrupt Russian diplomat.
The 100 Season 1 had a war occur between the Grounders and people from the Ark. In Season 2, the two factions ally against Mount Weather, which is kidnapping people from both sides to use as Human Resources, and has by far the most advanced military on the Ground.
The 4400: In "No Exit", P.J., one of Marco's fellow NTAC nerds, developed the ability to create fantasy world that force belligerent people to work together in order to survive. He regarded these fantasy scenarios as games which had to be completed for those involved to wake up. P.J. was greatly disturbed by both the state of the world since promicin became readily available to the masses and the developing conflict between NTAC and Jordan Collier. In the hope of fostering an understanding between the parties, he trapped himself, Jordan, Tom, Diana, Shawn, Kyle, Isabelle, Maia, Marco, Meghan and Brady in one of these fantasy worlds. It took the form of the NTAC building as it was important to everyone for different reasons. After Meghan and Shawn were killed, P.J. admitted that he was responsible for their situation and alerted everyone to the importance of working together to prevent any further deaths.
In the Agents of S.H.I.E.L.D. episode "Heavy is the Head", Raina helps SHIELD track down Carl "Crusher" Creel, a superhuman working for HYDRA, as she doesn't want HYDRA to get their hands on the incredibly dangerous artefact that Creel has stolen for them any more than SHIELD does. Unsuprisingly, this being Raina, she steals the artefact from under both HYDRA and SHIELD's noses.
A fun turn is later in the second season where Ward, who was a HYDRA agent, works with the team to face a common foe. Ward is under the impression this is part of his Redemption Quest to earn back the team's trust...not realizing the team are never going to forgive him and consider Ward the enemy.
Happens regularly in soap operas. For example, on All My Children, lifetime enemies Adam and Palmer teamed up to kill a rapist.
American Gothic (1995): Buck, Dr. Crower, Gail, and Ben are all forced to work together in the episode "The Beast Within", when Ben's deranged brother takes them all hostage: Dr. Matt's hand is hurt so he has to coach Ben in performing an emergency surgery, while Buck and Gail have to work together to find the lost key to the handcuffs holding them and Caleb prisoner. (The fact this all turns out to be The Plan orchestrated by Buck rather subverts the trope.)
And at the very end of the series, Merlyn is forced to go to Dr. Peele, Selena, and Ben for aid in digging up Buck's 'corpse' so that the two of them can then work together to save Gail and stop Caleb's rampage.
American Horror Story: Murder House: Constance forms an alliance with Moira, the ghost of the woman she murdered, to dispose of a sleazy developer who plans to tear down the house.
Angel: You're afraid of what's coming. Maybe we can help each other. The enemy of my enemy— Lilah: Can kiss my ass too.
Played straight when Angel later convinces Lilah to give him the information he was seeking, with the argument that Angel will either use it to stop The Beast (in which case Lilah wins) or Angel will die trying (in which case Lilah also wins). As it turns out, he decided to Take a Third Option. In the end, Lilah ends up allying with Angel's team.
Despite his mistrust and dislike of him, Detective Lance asks for the Arrow's help on multiple occasions. By Season 2, this has evolved into them having formed an understanding, and Lance being a Friend on the Force.
Season 3 has Oliver teaming up with his old enemy Malcolm Merlyn in an effort to learn about the League's methods and fighting style in order to mutually protect each other and Thea from the League's sights. The two still can barely stand each other, though.
The Season 5 finale sees Oliver recruit help from Merlyn, Slade, Captain Boomerang, and Nyssa al-Ghul to help him save his captured family and friends from Prometheus. The only people in this alliance who don't have a beef with each other are Oliver and Nyssa and Boomerang turns out to be The Mole.
Another episode has a scene deliberately written in defiance of the trope, which Straczynski hates. Mortal enemies Londo and G'Kar are trapped in an elevator with a fire outside draining their oxygen. Londo declares that they'll have to work together to escape but G'Kar refuses: he's perfectly fine with dying as long as he gets to see Londo die, too.
G'kar: (...) But I don't have to kill you. I don't have to do anything! And I still get to watch you die! I find this most appealing! Londo: This is insane! We must work together! G'Kar: ... No. As the humans say: "Up yours, guy." *Continues giggling*
The irony of this is that, if the Narn surrender treaty didn't include such harsh penalties for G'Kar just killing Londo, he might happily have helped. However, thanks to the excessive measures taken to prevent Narns attacking Centauri, this was the only way G'Kar would ever get to see Londo die.
Londo and G'Kar team up again in the "And The Rock Cried Out, 'No Hiding Place'" when Londo constructs a Batman Gambit to enlist G'Kar's aid in destroying Lord Refa, whom Londo believes killed his lover Adira and was responsible for using mass drivers on the Narn homeworld. Londo supposedly tricks G'Kar into leaving the sanctuary of station under the pretext of having the Centauri forces arrest him on Narn in Refa's presence; in fact, it was so G'Kar could make contact with the Narn resistance and set up the No-Holds-Barred Beatdown Lord Refa receives to the tune of the episode's eponymous Gospel tune.
Bester invokes the saying "the enemy of my enemy is my friend" in persuading Sheridan to work with him against the Shadows, whom Bester has also come to mistrust, in "Ship of Tears". He brings it up again when he finds out that his lover was abducted to become part of their Wetware CPU.
The general arc of the show is about most enemies putting aside their differences to face together the menace that the Shadows represent (albeit it is later revealed that the Vorlons are not much better). The Army of Light is made of basically every major and minor power of the Galaxy including many bitter enemies.
One particular egregious example of this is that after the Shadow War two really embittered enemies, the Narn and the Centauri, both join the Interstellar Alliance as founding members. However peace did not last as a sort of "civil war" broke off between the Centauri (puppeted by the former Shadow vassals, the Drakh) and all the rest, and at the last moment several former Centauri colonies like the Narn, Brakiri and Drazi eagerly bombed-down Centauri Prime which then withdrew from the Alliance. According to the Extended Universe, some 20 years later the Centauri with the help of the Alliance manage to get rid of the Drakh and the Centauri Republic re-enters the Alliance.
Battlestar Galactica (2003): Has this quite a few times as well, usually involving Cylons and humans co-operating, such as Athena's HeelFace Turn and the rebel Cylon faction seeking Galactica's help against Brother Cavil. However the "enemy of my enemy is my friend" quote is actually used by President Roslin when she teams up with terrorist-turned-radical politician Tom Zarek, after Commander Adama tries to force her resignation.
Season 9 of Blue Bloods kicks off with an overarching arc with Danny discovering the man who burned his house down at the end of season 7 (a hitman for a Mexican drug cartel). This is made even worse when he comes to learn that his wife's death is also on their hands. However a twist towards the end of the season puts them on the same side when the hitman's wife is murdered in his home by the cartel. Sharing a similar tragedy at the same hands, they quickly ally and bring down the leader of the cartel together. An episode during season 10 revisits this plot point and reaffirms that Danny and the ex-hitman still see eye-to-eye.
Breaking Bad: Hector Salamanca hates Walter White and would like nothing more than to kill him. However, Walter knows that Hector hates his mutual enemy, Gustavo 'Gus' Fring, even more and gives him a chance for revenge. Through an impressive Batman Gambit, they lure Gus Fring, who has his own vendetta against Hector, to Hector's nursing home. Hector proceeds to ding his bell one last time to detonate a bomb Walter planted on his wheelchair to take both himself and Gus Fring out.
Later as of 'Rabid Dog' Hank and Jesse, who have had a tremulous relationship at best, team up to take down Walt.
Buffy teamed up with Spike to stop Angelus at the end of season 2. With some unusual fallout; because the main time she'd met him had been during this Enemy Mine situation, when Spike returned in season 3, Joyce thought that they were actually allies and let him in. In season four he also teamed up with them a few times for various reasons (once because Giles just paid him to), and by the fifth he ran out of a need for outside excuses and turned into a straight ally.
Season 8 had Dracula team up with the Scoobies, who he hates (except Xander), for vengeance as the villains (Japanese vampires and a witch) had taken his power. Also, because he was kind of a racist.
In "Prophecy Girl", Xander enlists his hated enemy's (Angel) help to storm the Master's lair, and save Buffy. Angel scoffs at that, so Xander shoves a cross in his face for extra convincing.
A very brief one occurs in Season 3's "Choices", when the Mayor and Faith, in the interest of mutual survival, team up with the Scooby Gang in the high school cafeteria when demon spiders escape from the Box of Gavrok.
They tease this with The Master and Buffy in Season 8, but it never actually happens, unless you count him trying to sneak attack Twilight while he and Buffy are fighting.
The General very reluctantly works with the Slayers to fight the invading demon armies.
Castle: In the season 5 finale, Beckett uncovers a murder she initially believes was the work of Senator Bracken, the man who hired a hitman to kill her mother. She then uncovers that it was actually the work of a hitman setting up to snipe Bracken in two days, and is now forced to work with him on the investigation of an attempted murder of a man she would like nothing less than to kill herself. The irony is not lost on her.
Charmed (1998): This happens several times when the Halliwell sisters must reluctantly team up with demons for various reasons that are in the best interests of both sides, such as preventing the existence of magic from being revealed to the mostly unaware human population or stopping a neutral third party whose plan, if successful, would result in the vast majority of combatants on both sides being exterminated.
A strange case of this happens in Season 6's two-part season finale where that season's Big Bad, corrupt Elder Gideon, teams up with his evil Mirror Universe counterpart to trap two of the sisters in the Mirror Universe where they team up with that universe's version of their most notorious recurring enemy, the demon Barbas (since demons are the good guys in that universe) before fighting and then teaming up with their own evil counterparts in order to return to their own universe. Unfortunately, that causes the two universes to become unbalanced resulting in the normal universe becoming too good and the mirror universe becoming too evil, which forces the sisters to once again team up with their evil counterparts to restore the balance between both universes by killing both versions of Gideon, who have each meanwhile teamed up with their own universe's version of Barbas. In short, the entire episode is a confusing mess of various Enemy Mine scenarios.
"El retorno de Súper Sam": Chapulin has to team-up with his bitter rival Súper Sam (a mix between Superman and Uncle Sam) in order to fight a mad man escaped from prison that is stalking a girl.
In "La isla de los hombres casi solos" (Punny Name in reference to the famous novel La isla de los hombres solos from Costa Rican author José León Sánchez) el Chapulin helps two villains, Rascabuches and Matonsísimo Kid, because they are being abused by an evil female warden in a penal colony, forced to work 23 hours a day.
"La Horca", this was from the one-hour variety show Chespirito in the 80s and a two-part especial with Chapulin Colorado. He teams-up with two villains; Matonsísimo Kid and his daughter Rosa la Rumorosa and helps him escape from jail after he's sentence to death by hanging, as Chapulin opposes the Death Penalty. note The episode ends with An Aesop about the need for rehabilitation of criminals, as with the previous example, Roberto Gomez Bolaños held very progressive views regarding the treatment of convicts.
The first episode of Cimarron Strip had a gang member shot to death by his own leader in the Cimarron jail, so Marshal Crown enlists the help of the troublemaker in the adjacent cell, who had witnessed the murder, to find the one responsible.
In Cobra Kai, the students of Miyagi-Do and Eagle Fang end up agreeing to band together to take down Cobra Kai, with Demetri giving what may very well be the best pitch to join forces in television history:
Demetri: Hey pussies! This is exactly what those assholes at Cobra Kai want! Since you were one of 'em, you're an asshole too! So are you! So was I! At least I wanted to be one. But now Cobra Kai is the worst collection of assholes in the valley, run by the king of all assholes! So if by merging with Eagle Fang — weird name by the way — can keep us all from getting shit on anymore, then we'd all be assholes not to do it! ...I'm sorry for all the "assholes", I usually take pride in my grandiloquence but... it's an emotional time.
Community has a really bizarre example in the episode "G.I. Jeff". Jeff falls into a coma and dreams he's a member of G.I. Joe. However, since Jeff is aware of the show's conventions, he breaks the Nobody Can Die rule by killing the Cobra officer, Destro, instead of allowing him to perform a Villain: Exit, Stage Left as usual. This greatly shocks the other members of G.I. Joe who has never been confronted with actual death before, so they court martial Jeff for murder. Later when Jeff attempts to escape alongside the other study group members (also imagined as G.I. Joe members), he inadvertently manages to make things worse as during his escape he accidentally kills even more members of Cobra as well as the resident G.I. Joe medic, Lifeline. The fact that Jeff can actually kill people, eventually makes G.I. Joe and Cobra realize that he constitutes the single greatest threat to both of them by far, so they decide to combine forces and form the organisation "Jo-Bra" in an attempt to stop him.
Every story in Season 8 is about the Master coming up with some plan to destroy the world, someone (usually the Doctor) pointing out that performing this plan would end up screwing over the Master too somehow, and the Master teaming up with the Doctor to undo the damage.
Apparently what happened after "Frontier in Space", where the Master and Daleks tried to cause a war between Earth and Draconia after which they would invade the Galaxy. The humans and Draconians are told by the Doctor to form an alliance against the Daleks.
In "Genesis of the Daleks" when the Doctor has the chance to destroy the Daleks at their creation, one of the reasons he gives against this is that otherwise hostile races would be forced into alliances due to this.
The serial "Logopolis". Of course, the Master turns on the Doctor, tries to destroy the Universe rather than being unable to rule it, and then kills the Doctor by shaking him off a radio telescope into a parking lot. It isn't the end though, as the moment has been prepared for. Considering how the Master is just about the closest thing the Doctor has to a rival, they've certainly been forced to team up on any number of occasions throughout their history usually to stop a catastrophic evil that the Master himself unleashed, and invariably with the Master turning on the Doctor shortly before or after the problem is solved. Of course, the Doctor has been anticipating betrayal all along, and has almost certainly done something clever to come out ahead regardless.
Happens in the conclusion of "The Trial of a Time Lord", when the Master reveals that the prosecutor, the Valeyard, is actually the Doctor's Enemy Without, whom will get the Doctor's remaining regenerations if he gets the Doctor executed. The Master helps the Doctor for two reasons: to have an enemy with which he's more familiar (the Doctor vs. the Valeyard) and to retain the chance to end the Doctor's existence personally.
In "Doomsday", the presence of just four Daleks bumps an entire army of Cybermen down from "enemy" to "temporary ally". Once the Daleks start moving, Torchwood and the Cybermen appear to ignore each other in favour of the new targets.
"The Poison Sky": The attempted nuclear strike to destroy the Sontaran ship includes India, Pakistan, the USA, China and North Korea, but strangely not Russia.
In "A Good Man Goes to War", the Doctor calls upon the aid of the Silurians, Judoon and a lone dishonored Sontaran alongside actual friends to rescue Amy. However, the Silurians and Sontaran's reasons for teaming up isn't so much the presence of a common enemy as it is the fact that they owe the Doctor a debt.
"Asylum of the Daleks" is based around the Doctor and the main Dalek army working together to prevent an army of insane Daleks from escaping their prison and wiping them both out. The Doctor is forced into the alliance at gunpoint.
Comes close to happening in "The Time of the Doctor", where, like in "The Pandorica Opens", various races gather round the planet Trenzalore to restart the Time War if the Time Lords return. However much of this war is unseen and slightly subverted in that everybody is reluctant to start the war. It finally becomes Enemy Mine when on the other side, the Doctor and the Papal Mainframe, including the Silents, fight together.
"The Magician's Apprentice": The Doctor goes missing, and Missy then turns up, with Clara forced to work with her to locate the Doctor.
"Resolution": In the backstory, three warring factions in ninth century Britain end up working together to fight and imprison an incredibly dangerous alien that arrives on planet Earth, which speaks volumes about how much of a threat just one single Dalek is.
The Expanded Universe multi-media event Time Lord Victorious features the Tenth and Eighth Doctors making an alliance with the Daleks. The Tenth gets dragged to Skaro to defeat a different Omnicidal Maniac race, the Hond, who are trying to destroy the planet and everything else. He ends up teaming with an individual Dalek, the Dalek Prime Strategist, to recover an ancient weapon (complete with banter between the two). The Eighth ends up on a Dalek ship about to crash into a planet, and has to work with them to ensure both he and they survive.
In an episode of Drop Dead Diva, Jane uses this tactic on two of her clients who were screwed over by the same guy. They are at first exhibit animosity toward each other, but she tells them to team up and get revenge. At first, Parker believes she was inspired by the old proverb, but Jane (who was an aspiring model in a former life), was actually inspired by an episode of Beverly Hills, 90210, which Parker actually recognizes.
Played straight in the "Liars, Guns, and Money" trilogy when Moya's crew recruit various aliens who had tried to kill them in the past to help them pull off a heist.
Played straight and subverted with John and Scorpius multiple times as John pretends to team up with Scorpius, then John is forced to team up with Scorpius to save Aeryn (twice!), then it looks like Scorpius has betrayed them but he really hasn't, then John betrays Scorpius only to have to go back and save him again. And then they end up teaming up with Scorpius again for the miniseries, still against John's better judgment.
Firefly: Does this in the episode "Trash", where the crew joins up on a heist with Saffron, the psychotic seductress who tried to steal their ship a few episodes back. Rather amusingly subverted: Saffron unsurprisingly double-crosses the crew, and the crew turns on her in return, having fully expected her sudden but inevitable betrayal.
In an episode of The Flash (2014), the titular hero is forced to temporarily team up with Leonard Snart (AKA Captain Cold) and his sister Lisa (AKA Golden Glider) in order to help transport a bunch of dangerous meta-humans from S.T.A.R. Labs to Lian Yu. Naturally, Snart betrays Barry and releases the meta-humans (except for one, whom he kills for ostensibly owing him money), figuring they now owe him one. At the end of the episode, Barry admits he probably shouldn't have trusted a known felon.
One of the series' primary arcs deals with different factions setting aside hostilities to work together so they can defeat the threat of the White Walkers. The Targaryens lead by Dany, the Starks lead by Jon, and the wildlings are on board but Queen Cersei Lannister reveals to her brother that she's secretly planning to not join the alliance, hoping that the White Walkers will take out her enemies. Jaime clearly sees this as sheer insanity and breaks from his sister to help Jon and Dany.
This is the reason that the wildlings are all united under a single leader. Every tribe hates each others' guts; they just hate the idea of dying in droves to the White Walkers more.
The Lannisters and the Tyrells against Stannis.
Of particular note is Loras Tyrell, who initially views the Lannisters as his enemy but chooses to side with them to avenge his lover Renly.
Jaime and Brienne become this when they are captured by Locke.
Oberyn Martell champions Tyrion much more for a chance at revenge than for any sense of justice or personal connection between them.
Ser Alliser Thorne tells Jon outright that they will go back to hating each other after the battle is over.
Subverted by Stannis and Renly, who refuse to cooperate with anyone who refuses to submit to them. Renly at least offers to let Robb remain king in name, but Stannis refuses to view any other claimant as anything but a usurper who must be forced to submit.
The Tyrells set aside their centuries-long rivalry with Dorne and join Daenerys when Cersei murders every Tyrell save Olenna, who jumps at the opportunity to join the Sand Snakes in their quest for vengeance against the Lannisters.
Despite his open distaste for the Boltons (and their Karstark allies), Smalljon chooses to ally with Ramsay Bolton because of Jon Snow's decision to let the Wildlings through the Wall as Smalljon believes that this will result in them razing the Umbers' land.
Euron tries to propose a marriage alliance between him and Cersei despite their houses' past animosity in order to counter the coming Targaryen invasion. She rebuffs, though Euron has far from given up on his efforts.
Get Smart: In one episode, Max Smart from CONTROL and Siegfried from KAOS team up against a man conspiring to destroy the world, since if he succeeded they would have nothing to fight about and would be out of a job.
Nick and Renard's relationship during seasons 3 to 5 of Grimm is like that. They became allies because they have a common enemy; The Royal Families.
Heroes: This is the favorite way they deal with Sylar.
Volume 3 has Noah Bennet work with Sylar to stop the escaped Level 5 villains. The two barely tolerate each other but seem to have bonded by the end of the 3rd episode. Then Sylar starts up with the brain-stealing again, causing Bennet to vow to kill him eventually.
What Noah meant could very likely refer to taming Sylar. In Season 3, Episode 4, "I am Become Death", Peter is taken to a future timeline by his future self. In this timeline, Peter discovers a calm and collected Sylar, living in the Bennet household with a son named Noah.
Also, in the Volume 3 finale, Bennet frees all the Level 5 supervillains so they can help fight Sylar, who's on the downswing of his HeelFace Revolving Door trend. They all last maybe 3 minutes, tops.
Volume 5 does this again when Peter realizes that in order to prevent Samuel Sullivan's plans from coming into fruition, he's going to need Sylar's help. Unfortunately, it meant getting himself stuck inside Sylar's head and dealing with the latter's Villainous BSoD. Unlike the many times before, though, it works; the two save the day, and Sylar's HeelFace Turn seems to stick this time.
House of Cards (US): In Season 3, the Republican and Democrat congressional leadership team up to oppose President Underwood's America Works program. It backfires against the Democrats when, after America Works goes bankrupt after they cut off the money, Underwood uses it as justification to renege on his promise to not seek a term of his own in the White House.
Kamen Rider Decade: In the final arc, the separate Kamen Rider worlds are pitted against each other in a giant war, with the losers being erased from existence, so naturally Riders and Kaijin put aside their differences in order to protect their universes. Tsukasa, in the meantime, tries to convince everyone to focus on the common enemy in Daishocker; it works almost too late, but then the death of Apollo Geist actually accelerates the destruction rather than stopping it. Dammit.
Kamen Rider Ex-Aid: Doctor Riders are about the most incompatible bunch you can get, so having similar goals doesn't stop them from hating each others' guts for very valid reasons. They (somewhat) willingly team up against GraphiteBugster. What follows is hilarious example of Teeth-Clenched Teamwork as they bicker and try to one-up each other while not interrupting the flow of the battle. Then Kamen RiderGemn shows up, kills one of them and they finally get their shit straight. The bickering stays, but they are more interested in beating Gemn than each other.
Desperate effort against Kamen Rider Cronus brings all the factions together to plan their next steps not very long afterwards.
Kirby Buckets: Dawn and Kirby usually hate each other's guts, but the two have worked together in several episodes, like "Kick the Buckets", "Send in the Clowns", "Failure to Launch", and "Weekend with Inga". Unfortunately, they're always back at each other's throats by episodes' end.
Law & Order: Criminal Intent: Detective Goren's arch-nemesis Nicole Wallace supplies him with information allowing him to prevent her fiancé from killing his own daughter, who Nicole loved as her own. Ironic, considering Nicole killed her real daughter.
The initial premise of Legends of Tomorrow is that a team up of the some of the heroes and villains of the Arrow and The Flash (2014) franchise is necessary to stop an immortal villain, as claimed by the time-traveling Rip Hunter. Leonard Snart even points out that he can't imagine a future where he's considered a hero (he would probably consider it an insult). Hunter points out that they're not heroes, they're legends.
Nate teams up with Sterling for "The Zanzibar Marketplace Job".
Also in "The Last Dam Job", the team brings in a few people who have been enemies in the past. Eliot and Quinn, in particular, have a perfectly amicable working relationship despite the fact that they tried to beat one another to death in the Season 1 finale.
Lost: Has done several times, both in regards to the survivors and the Others.
In Season 3, when Kate and Juliet are handcuffed together and forced to work together to escape the smoke monster's repeated attacks. It turns out Juliet herself handcuffed them together to try and gain Kate's trust.
Throughout the second half of Season 4, Ben joins forces with Locke's group to fight the freighter mercenaries.
At the end of Season 4, Kate and Sayid team up with Richard and his army of Others to rescue Ben from the mercenaries.
Then there is the reluctant team-up between Losties and the Others of 1977 in the Season 5 finale.
Finally, Season 6 had everyone teaming up against the new Big Bad. Ben Linus and Charles Widmore sure were surprised to find themselves working toward a common goal!
MacGyver: Murdoc and MacGyver work together to rescue Murdoc's sister in "Halloween Knights".
In Chapter 13 of The Mandalorian, Din Djarin is sent by the evil magistrate of Calodan to kill a Jedi who has been causing her trouble, largely because Jedi Knights and Mandalorians have been enemies for thousands of years; said Jedi turns out to be Ahsoka Tano, and she and Djarin team up against the magistrate. The "enemy" part of this, however, is downplayed, as there's no personal enmity between the two; Ahsoka has worked with Mandalorians before, while Djarin has only recently heard of the Jedi and has been actively seeking her out as part of his quest to return the Child under his care to his people.
The Man from U.N.C.L.E.: Had this trope as part of its central premise, as THRUSH forces the Western nations and their ideological opponents the Soviet Union to cooperate in forming UNCLE.
M*A*S*H: Charles Winchester, ordinarily a foil to Hawkeye and B.J., will occasionally join forces with one of them against the other (usually as part of an Escalating War), or with both of them against a common target. The latter moments tend to highlight Winchester's Jerk with a Heart of Gold qualities, given that the people he targets are always bullies themselves, such as a racist colonel, or a man bigoted against stutterers, or the insanely jingoistic Colonel Flagg.
Flagg's mistake was trying to blackmail Charles into helping him with a threat of prison. Charles doesn't like being manipulated in that way, and knows precisely how to deal with it (he tricks Flagg into trying to arrest Colonel Potter, and the Mayor and police chief of Ouijonbou, all three of whom have the right contact to get rid of Flagg for good now that they have something solid against him).
One good example is the episode where Hot Lips is being accused of being a communist by a congressional aide. Without even being asked, Winchester takes a stand against the aide and takes up for Margaret.
Due to a misunderstanding and accident of timing, the Colonel who sent Charles to the 4077th attacks Margaret (thinking she's the woman Charles procured for his entertainment). The Colonel offers to transfer Charles back to Tokyo, and all he has to do is lie about what happened with Margaret. Charles is clearly tormented by the decision, but chooses to tell the truth as he cannot stand to destroy Margaret's career for his own (relatively modest) gain.
Merlin (1998): Merlin himself outright states that this is his motivation for allying himself to Uther. Uther's enemy, Vortigern, is Merlin's enemy and has joined forces with an even worse enemy.
Monster Warriors: In "Attack of the Leaping Leeches", the series Big Bad Klaus Von Steinhauer seeks the Monster Warriors' help when giant, leaping leeches attack him and his monster-movie film crew.
Naturally, Sadie: While not as big of enemies as most of the other examples, this show uses this a lot to get characters who dislike one of the main cast to work alongside them, usually for a school project. One memorable incident has almost the entire teenage cast working together in detention while the remaining member teams up with Mallcop — two examples in one episode, there are many more.
The New Adventures of Robin Hood: In "Attack of the Vikings", Robin must rescue both himself and his archenemy when he and Prince John are kidnapped by Vikings.
Defied when Division's rival Gogol tries to enlist Nikita to help them recover a dirty bomb.
Ari Tasarov: The enemy of my enemy— Nikita: —is just another man standing in my way.
Played straight later when Gogol, Division, and Nikita collaborate to get Alex out of danger after she confronts Sergei Semak, the uncle who had her father killed so he could take over the family business.
Once Upon a Time: In the Season 1 finale, Emma and Regina briefly team up in order to save Henry's life.
Regina later teams up with Mr. Gold in Season 2, in order to stop Regina's mother, Cora, from getting into the real world.
Season 2 ends with a massive one between Regina, Emma, Snow, Charming, Gold, and Hook to save Henry (again) after he gets kidnapped to Neverland. The team-up has...varying levels of success.
In Season 4, Arc Villain Maleficent eventually decides to form one in the final three episodes with Emma and company, striking a deal for Emma to find Mal's daughter, Lily.
In The Orville two-parter "Identity", the Union is forced to temporarily ally with the Krill in order to stop the genocidal Kaylon.
Oz: Happens all the time in this prison drama as the various factions struggle for control of the drug trade, or seek to murder a rival.
Person of Interest: In her war against HR, Joss Carter first allies herself with crime boss Carl Elias and then has him form a temporary alliance with the rival Russian syndicate.
At one point, Reese and Shaw team up with Hersch in order to take down Vigilance, since they need to find Finch and he needs to find Control, and Vigilance has both of them.
Power Rangers: Certain incarnations have done this, particularly Power Rangers Zeo. The Big Bad of the moment has brainwashed The Hero and the Sixth Ranger's attempt to save him has failed. It turns out that last year's villains have the technology to send the rest of the team over. They do, just to screw around with the new villains.
Likewise, a villain variant of this was completely subverted in Turbo: A Power Rangers Movie. Newly anointed Big Bad Divatox calls decayed villain Rita Repulsa for help, and gets laughed at. Rita's Captain Obvious response is that if she knew how to defeat the Rangers, she would have done it already.
Resurrection Ertugrul: Emir Sadettin Kopek briefly teams up with Ertugrul and Aliyar in the third season after a now-independent Batuhan abducts Aslihan (Whom Sadettin desperately wants to marry) for interrogation, prompting the Bey of the Kayis to help him just this once.
Revolution: As of episode 14, the Resistance and the Georgia Federation have allied to open a two-front war against Monroe.
In season 2, the heroes end up allying with pretty much all their surviving enemies since they need to top the Patriots before they take over most of the old United States and enact their genocidal policies.
Robin Hood: In the first season of the BBC's show Robin and the sheriff temporarily fight side-by-side in order to defeat a group of Saladin's assassins. In the third season Robin and Guy team up in order to save their half-brother Archer from execution.
Saturday Night Live: No matter how much Sean Connery would try to antagonize Alex Trebek during the Celebrity Jeopardy skits, the two of them would often commiserate over another contestant's idiocy:
Connery: (in response to Robin Williams' antics) "Boy, you might be legally retarded".
Trebek: "You have a point".
Connery: (in response to Anne Heche's equally loopy behavior) "She's a nutjob, Trebek."
Trebek: "Tell me about it."
Connery: "She's nuttier than a pecan log."
(he and Trebek crack up)
Scrubs: Even features this trope when Dr. Cox and Dr. Kelso team up to break the spirit of an overly cheery coworker. However, she outsmarts them and they are back to mutual hate by the end of the episode.
Another episode featuring Dr. Kelso has him realizing one of the reasons the hospital keeps going is that everybody is united against him. In the future he'll purposefully invoke it to keep the staff going in moments of stress or instability.
Seinfeld: in episode "The Andrea Doria" Jerry and Newman who are Sitcom Archnemesis join forces to have Newman transfered to the Hawaii route, as is the dream of both (for Newman to be in Hawaii and for Jerry to have Newman move).
There are also various times in season nine where the good guys have teamed up with TessMercer. Chloe in particular joined forces with Tess in episodes like "Upgrade" and "Sacrifice" so that they can both protect their secrets. (Tess's season ten HeelFace Turn takes the 'enemy' out of the equation, so all post-S9 teamups aren't this trope.)
Stargate SG-1 features this a great many times. It seems to be one of the favorite negotiating tactics of the Tau'ri in particular.
Ba'al has had to join forces with SG-1 to defeat his master Anubis and the greater threat of the Replicators during the "Reckoning" two-parter. This is not the last time they'd work with him. Initially subverted, as Ba'al asked SG-1 for an alliance and was flat-out rejected by Jack O'Neill.
O'Neill: I've got a better idea, instead of helping you, why don't we sit around and watch you get your ass kicked? That way you'll be dead, and we'll be glad.
Special mention just has to go to the two-parter "The Quest", where SG-1, Ba'al, andOri messiah Adria team up to solve Morgan le Fay's puzzles.
There is also an SG-1 episode entitled "Enemy Mine", though it is unrelated to this trope at first. The conclusion is somewhat an example of this trope, as the Colonel overseeing the mine and the Unas definitely considered each other enemies until the compromise where they agreed to work the mine themselves so long as it contributed to killing some Goa'uld. Plus they look a little Enemy Mine Lou Gossetty, what with the scaly skin and labored manner of speaking.
The original alliance (the one led by Ra) against Anubis, whose crimes were apparently considered unspeakable, even amongst the System Lords. Think about that.
Sokar was banished from the System Lords for much the same reason, and by much the same method.
According to Thor in "Fair Game", it is precisely because of the concept of "enemy of my enemy" that the Goa'uld System Lords banded together in the first place. Due to their Always Chaotic Evil nature, however, it takes a serious threat (like the Tau'ri) to convince them to work together for any extended length of time.
The "Giant Aliens" (later named Omeyocans by the novel City of the Gods) in the episode "Crystal Skull" quote the full line verbatim to SG-1. In Mayan, no less. And then they're never heard from again.
Then there's the various times the SGC temporarily allied with Lord Yu. To paraphrase Daniel Jackson, Yu is not to be liked or trusted, only trusted to make a practical decision unhampered by the usual Goa'uld mindset.
Sheppard and a wraith cooperated to escape custody of Kolya in the episode "Common Ground". This included the wraith feeding on Sheppard to have the strength to fight off their enemies, giving it the opportunity to double-cross our hero. However, he returned all the Life Energy he took (and possibly made up for a few months Sheppard spent in a time-dilation field) and Sheppard made good on his promise to let it go free. The wraith in question, later dubbed "Todd", would become a recurring character, and is notable for being unusually sociable for a Wraith, even joking with the heroes.
Taken Up to Eleven in the final battle against the Asurans, where the Earth, Traveller, and Wraith ships fight side by side against the Asuran warships in what is hands down the single most awesome space battle any of the three series has managed (Stargate Universe, being set on a Cool Starship, had a chance to top it before it was cancelled). This is even more impressive given the distinctly quarrelsome nature of the Wraith, thus the battle is a meld of nine factions (7 Hives, Atlantis and the Travellers) rather than 3 as some may think.
After he escaped the first time, Michael teamed up with the Atlantis team to bring down his former hive after his queen snubbed him. This didn't work out well for either side.
Star Trek: In general this franchise is all over this trope. The Klingons team up with the Enterprise crew in "Day of the Dove", the Klingons allying with the Romulans against the Federation and then later with the Federation against the Romulans, Voyager teaming with the Borg in "Scorpion", The Alliance of the Alpha Quadrant (and the poor, forgotten Beta Quadrant!) against the Dominion, etc., etc.
Star Trek: Deep Space Nine: Kira, Damar and Garak loathe each other. The fact that Damar killed Garak's Love Interest and Kira's surrogate daughter a few seasons back does not help. Eventually, the fate of Cardassia, and with it the entire Alpha Quadrant, rests on the three of them putting aside their differences and working together to create a rebellion to overthrow the Dominion control of Cardassia. It even leads to the beginning of Fire-Forged Friends.
The Andorians and Vulcans learning to work together have some shades of this trope (though the fact that one of the enemies faced together is extremist elements in the Vulcan governments complicates matters), especially during the last season (the Romulans' meddling intended to break the Coalition ends up strengthening it by giving them a common foe: the Romulans. Oops).
Rather famously, the Tamarian for this trope is "Darmok and Jalad at Tanagra."
TNG also did it in "The Enemy", where Geordi and a Romulan had to work together.
Star Trek: Voyager: This is the plot, although by the third season the rival crew factions have been forgotten.
In a later season of Voyager, in the episode where the Delta Flyer is introduced, B'Elanna Torres learns that the Maquis lost back home. She turns depressed and does dangerous things in the Holodeck with the safety off, and because most of the ship has all but forgotten their initial division between Starfleet and Maquis, they don't know what's wrong with her.
When they first re-establish contact with Starfleet, Janeway mentions to Chakotay that she actually had forgotten the implications of the mixed crew after they had been working together for so long. She becomes concerned for what happens when they got home, since as far as Starfleet are concerned, the former Maquis crew are still wanted terrorists?!
Janeway's alliance with the Borg in Delta Quadrant against Species 8472 (where the crew picks up 7 of 9).
Supernatural: In season 5, Sam, Dean, and the others join forces with the demon Crowley in an attempt to defeat Lucifer.
An odd example when Gabriel joins forces with the Winchesters and goes up against Lucifer, resulting in his death, since he spent most of the time he knew them tormenting them. Although it's implied that he knew that they'd eventually do, which is why he gave them such a hard time.
And later join forces with Meg to defeat Crowley.
Which is an interesting use of this trope, seeing as Meg was a staunch Lucifer loyalist whom the boys had fought against in the same episode they first allied with Crowley against Lucifer.
In season 7, the Winchesters are aided by several old enemies (Meg, Crowley, and the Alpha vampire) at different points and for various reasons in order to defeat the Leviathans. Of the three, Crowley is the one who double-crosses them when things are over and done with.
Teen Wolf: Scott, Allison, Chris, and Kate versus Alpha Peter Hale in the season one finale.
And then not-so-Alpha Peter with Derek versus Gerard and Kanima Jackson in season two.
Terra Nova: The episode "Now You See Me". Taylor and Mira's "Your place or mine" hostage struggle is interrupted by a pair of young and territorial Slashers. Leading to Taylor to hand a knife to Mira and say We can fight each other, or we can fight them.
Time Gentleman Please: Played for Laughs. The Pub Landlord loathes the French, due to his wife running away with a Frenchman and taking his beloved son away from him. In one episode, the Frenchman walks into his pub, causing him to immediately begin a tirade, before the Frenchman cuts him off and reveals that she's left him... for a German.
Pub Landlord:[shakes hand] The mutual enemy, all hostilities are now ceased!
The Timeless episode "The Capture Of Benedict Arnold" involves the protagonists having to team up with Garcia Flynn to capture Benedict Arnold, as he has connections to the original founder of Rittenhouse. This alliance ends up falling through, due to Flynn also wanting to kill the founder's son, which the team won't let him do.
In Season 2, with the team now incredibly desperate to stop Rittenhouse (which has moved from Greater-Scope Villain to Big Bad) from rewriting history to create a Police State, they form a more permanent alliance with Flynn, actively recruiting him to the team.
The episode has "Mrs. Sherlock Holmes" has top Rittenhouse agent Emma choosing to help the team find another Rittenhouse sleeper agent sent to stop the Suffragist movement that would lead to women getting the right to vote, explaining womens suffrage being a personal, important influence of her past.
The Vampire Diaries: Damon will take a break from harassing Stefan if there's a bigger threat, or if it's in his interest.
If the promo for "Before Sunset" is any indication the brothers will work with Klaus to stop Alaric.
The premise of the dark comedy Vice Principals is that long-time high school teachers Neal Gamby and Lee Russell hate each other's guts and make it clear how badly that hate is. When the school principal retires, each man assumes he'll be picked for the job. Instead, it goes to a qualified black lady from outside the school. The two realize they have to put their animosity aside and work together to take the woman down first so they can then fight it out for the job.
Wonder Woman: In "The Queen and the Thief", Wonder Woman teams up with the Thief, Evan Robley, to recover Queen Kathryn's crown jewels. Robley had originally been hired by Ambassador Orrick, only to switch sides when he discovered he was being set up as the fall guy.
Wynonna Earp: During the final episodes of Season 3, Wynonna allies with the revenants her family's been at war with for over a century against Bulshar, on the grounds that he's the one who cast the Earp Curse (which created the revenants and keeps dragging them back from Hell) and set the two sides against each other in the first place, and killing him will break it.
Xena: Warrior Princess: In "A Necessary Evil", Xena enlists the aid of her enemy Callisto to fight Velasca, an Amazon who acquired the powers of a goddess. At that point, Callisto had recently become immortal and was the only person available to go up against her, despite Gabrielle's protestations.