It depends on what they say on the stand, and the level of immunity granted. (Keep in mind, that I am not a lawyer.)
Okay, let's say, and why not, that you're called to testify about something IT related for your company. The prosecutor could choose to grant you immunity to prosecution for anything at all you that say on the stand, OR immunity to prosecution for anything that you say on the stand that is related to the case, OR not grant you immunity to prosecution at all.
So, let's say your company was up to various tax related shenanigans. You work in IT, and you have access to all the email records of the company, or various records, or whatever.
The prosecutor, finding out about this, compels you to testify. Now, if you were complicit in the tax shenanigans, maybe you're reluctant to testify. He could charge you, and make you a co-defendant, but maybe he can't prove you were directly involved, that could make his case weaker, etc.
Or he could make you a deal. "Testify about the shenanigans, and I won't prosecute you for the shenanigans."
Or he could make you a blanket deal "You won't be prosecuted for anything you say on the stand." (Although this would be stupid of the prosecutor if he doesn't know exactly how deeply involved in the shenanigans you are, or what else you might confess to.)
Now, by offering immunity from prosecution, the main goal is to get the testimony that you might be reluctant to give. But, see, you're not going to be charged with anything. That removes a huge roadblock. But it doesn't guarantee that the person offered immunity will still testify.