They have actually worked together on several occasions. They make a pretty good team. Both are dangerous and resourceful. The only one who can really stop the other is each other. Here are a few more in addition to the ones above.
::Spoilers on some old back issues:
Once The Penguin was murdered on live television by The Joker. Then Joker turned up and asked Batman to help him solve the crime because he swore he didn't do it. He wanted to avenge Penguin. Back then Penguin and Joker were written as being friends. Joker even cried over Penguin's dead body when he didn't know Batman was watching. During the investigation, Joker would occasionally give in to his uncontrollable impulse to try and kill Batman. But he had enough self control to use methods he knew wouldn't work. Cause they are friends and allies, you see. A bucket of acid over the door, or trying to run him over with the Batmobile. Just harmless fun between friends.( Insane Joker logic at its finest!)) Turned out Penguin used a Joker doppelganger and faked the whole thing so he could go under cover ( as a nun..penguin..get it?) and pull a big heist. Of course, being The Joker, the first thing he did when he found out his friend was all right was strangle him for upsetting him.
Another time Joker helped Batman with a kidnapping case of a little girl. It was very Silence of The Lambs and Joker really got into Batman's head. But they saved the child.
They also teamed up to save the world from Ra's Al Ghul. But Joker had been turned temporarily sane at the time.
In an non canon cross over Joker, Captain America, and Batman eventually worked together against The Red Skull .In fact, The Skull had gotten past Batman and Cap and was about to nuke New York when The Joker popped up and saved the day.
During The Infinite Crises story they had a sort of symbiotic coincidence. Alexander Luthor had been defeated and Batman actually pointed a gun at his face. He knew if Alex Luther lived he would threaten the multiverse again. But Wonder Woman kept him from pulling the trigger. ( She just had to say his name to snap him out of it) Luthor escaped. But just a few pages later Alex ran into Lex Luthor and Joker and Joker killed him. Saving the multiverse and removing the threat the way Batman couldn't let himself. Not that saving any one was Joker's prime motivation,but he is fond of saving his own world to play in. Plus Alex had wounded his ego. What I found interesting was the panel layout and art work of Batman and Joker walking up and putting guns in Alex Luthor's face were very similar. I am pretty sure it was deliberate on the artist part.
In the Justice mini series Joker served in the same capacity. He worked against The Legion of Doom and Brainiac from the shadows while The Justice League waged their war with them. His well timed explosives turned the tide of the battle.He also took down Scarecrow and was waiting for The Riddler and others at Arkham to pay them back.
There have been other times but those are the ones I can think of off the top of my head.
That's the thing about The Joker. He is the personification of the wild card. There is no telling which side he is on, besides his own. Anything for a laugh, right?