I'm not posting this as an answer because I don't remember the exact issue name and it doesn't quite match up. However, there was a batman and captain America crossover where joker and red skull worked together. In the end, joker ends up turning on red skull when he learns of his plans, saying something like "I may be a crazed psychotic homicidal maniac, but I'm an AMERICAN crazed psychotic homicidal maniac!" And ends up blowing the two of them up, leaving batman and captain America trying to figure out what just happened.
– BroklyniteNov 24 '15 at 10:35

I'm posting this as a comment because although they might have teamed up in the story I'm going to mention, Batman refused the assistance. He tries to team up with Batman in the Injustice: Gods Among Us videogame at some point, but gets locked up in a cell instead. A pity, really, because it would have been an amazing team-up should it ever have happened.
– RenanAug 31 '16 at 18:32

7 Answers
7

Within the comics continuity, yes.

Comics Alliance explains that the story of The Brave & The Bold #191 is about Batman and The Joker teaming up to figure out who murdered The Penguin on live TV.

Comics Alliance also notes that such team-ups between them have occurred multiple times, but always as a matter of extenuating circumstances.

For one thing, it’s a Batman/Joker team-up story. That actually happened more often than you might expect — Bob Haney did it twice during his run, within eight issues of each other — but it’s always one of those things that requires some extenuating circumstances.

Anyone else who is resurrected by the Lazarus pit comes out temporarily insane. As usual, things are subverted with the Joker, and he emerges from the pit calm, rational, and filled with genuine remorse for all of the pain he has caused.

This newly sane Joker goes with Batman to defeat Ra's al Ghul. (Not that he's useful, he just mopes around a lot).

And, of course, the effects of the Lazarus pit are temporary, so by the end he's back to the insane psychopath we know and love.

While not exactly an alliance in the classic sense of the word, there is a certain amount of cooperation in the Arkhamverse, especially in City and Knight.

Note: spoilers for the Arkham City and Arkham Knight video games follow.

Arkham City, Batman is forced to help Joker find a cure for his illness after being infected with his blood. Batman finds a cure together with Mr Freeze, and administers it to himself, but before he can cure Joker, Joker ambushes him, accidentally destroying the only cure that can heal him. Joker dies shortly afterwards.
In Arkham Knight, it is revealed that Joker's blood turned the infected people insane, Joker style. 4 people were infected, along with Batman. 3 of the normal people infected turned into Joker copycats soon after infection. The 4th infection took hold during the events of Arkham Knight. Early during the events of Arkham Knight, Batman inhales a large dose of Scarecrow's toxin, forcing the Joker Personality to emerge.
The Joker Personality is present throughout the rest of the main storline. providing comments on the situation in Joker's classic sarcastic tone. During 2 segments of the storyline, the Joker takes control over Batman. The first time, it is unintentional, after Scarecrow sprays additional toxin in Batman's face onboard the Stagg zeppelin. The second time could be seen as intentional: Batman has been forced to surrender to Scarecrow to save his friends, and Scarecrow injects him with toxin. Unbeknownst to Scarecrow, Joker was waiting for this moment to take over Batman. Scarecrow thus was surprised when Batman said he was not afraid, and injected him again. This then made Joker become afraid of being forgotten and allowed Batman to take control again.

Neither of these are alliances in the classic sense of the word, but especially the events of City sound like what you are looking for: a common goal in saving both of their lives. Arkham Knight is a bit more tenuous, but it could be argued that they both had the common goal of saving Gotham from Scarecrow, although Joker had the goal on top of that of gaining control over Batman.

During the Justice Leagues story arc, the original JLA was erased from everyone's memories, and the various League members each created their own interpretation of 'A' (Aliens for Superman, Atlantis for Aquaman, etc.). Batman created the Justice League of Arkham, for which the Joker was a member. They worked together at first, but near the end the Joker and the rest of the villains turned on Batman.