In Act Three, Giles is arrested because he won't reveal the witness that claims to have heard Thomas Putnam admitting that he was accusing his neighbors of witchcraft so that he could swoop in and buy their land. Someone told Giles they heard Thomas saying that, and Giles knows that if he were to reveal the witness, that witness would be arrested. So, Giles refuses, and is arrested himself as a result.
This action serves several purpsoes. The first is to alert the reader to just how power-hungry, suspicious, illogical and defensive the courts are. Corey's statement is just one of many attempts that John and his friends make to try to set their wives free, and it is just one more example of the courts not listening, and arresting the people making the claims instead. So, Giles plays the role of further revealing the court's corrupt nature.
It also plays a role is letting the readers know that Giles, even though he is a grumpy and cantankerous old man who serves as comic relief quite often, is actulaly a man of integrity who cares deeply about other people. He refuses to give the man's name, in order to protect him. He would rather get arrested than send someone else to jail. It adds character depth to his personality, depth that makes him a bit of a hero.
Giles and the statement he made also reveals that Putham is a conniving schemer willing to murder his neighbors in order to increase his wealth. This is crucially important information for the context of the play, and vital to understanding the motives of why many of the accusations occurred.
I hope that helped; good luck!