This is a show-only event, and it is a direct consequence of it being impossible to show Ser Barristan joining Daenerys incognito without the viewers realizing the deception. In the books, it was Ser Barristan who revealed Ser Jorah's betrayal. In the show, it was Tywin who did it by sending an official pardon to Daenerys -- thereby betraying Jorah and weakening Dany by sowing discord between them. The show and the books have been forced to deviate from each other here, mostly because watching is different from reading. I'll try and relate both perspectives briefly:
In the books, Ser Barristan goes to Daenerys in disguise, calling himself Arstan, a squire to the pit-fighter Strong Belwas (a favourite character to many). He does this so that he will be able to observe Dany before swearing his sword to her, to see that she is not mad like her father. In the end, he reveals himself when he saves Dany's life when she is ambushed by Mero of Braavos, aka the Titan's Bastard. This is also when he reveals Jorah as the spy who has been selling Dany's secrets.
In the show, we immediately see that Arstan is Ser Barristan, so it is not possible to keep the illusion from the books. Hence, Ser Barristan cannot keep the secret of Jorah hidden until future seasons, which means in the show, he never knew. Mero is killed by Daario, and the secret of Jorah is revealed by Tywin.
In the end, the show was forced to do quite a few re-writes to make this work. One of my least favourite re-writes was that they changed the designation "old man" from Arstan (Ser Barristan in disguise) to Ser Jorah in the scene with the slaver from Astapor and Missandei:
"Even the bravest men fear death and maiming," Arstan said when the girl was done.
Kraznys smiled again when he heard that. "Tell the old man that he smells of piss, and needs a stick to hold him up."
"Truly, your worship?" [said Missandei]
He poked her with his lash. "No, not truly, are you a girl or a goat, to ask such folly? Say that Unsullied are not men. Say that death means nothing to them, and maiming less than nothing."
But all in all, the show did a good job, and the revelation of Jorah still gets a poignant touch, though it is Tywin who sends a malignant message that destroys the trust Dany has in Jorah. As opposed to Ser Barristan's honour.
This is a good example of how adaptations to a visual media are difficult to perform, and that small changes grow bigger and bigger further along the storyline.