A social reformer, Dickens includes Newgate Prison because he wished to expose social conditions in London while developing the deeper nature of Pip's character. Dickens himself worked hard against the Poor Laws that incarcerated many for things other than crime.
An infamous prison, Newgate was a place of detention for those awaiting trial or execution. In addition, Newgate was used as a debtors' prison--Dickens's father was incarcerated there for his debt. Because Newgate was notorious for the overcrowding and horribly inadequate conditions, physicians would refuse to enter Newgate. Amazingly, prisoners were actually expected to pay a fee upon entry into this prison, and they were expected to pay for even the basic "comforts of life." Upon their release, prisoners also were expected to pay another fee before they were allowed to leave.
When Wemmick takes Pip to Newgate, Pip is appalled at the conditions.
... the prisoners, behind bars in yards, were buying beer, and talking to friends; and a frouzy, ugly, disorderly, depressing scene it was.
As Wemmick moves around as though he is in a garden taking "portable property" from the inmates, Pip is initiated into the way Newgate works and the world of Wemmick and Mr. Jaggers. Moreover, he comes to realize what a shrewd man Jaggers is and how he does not become emotionally involved with any of his clients--it's money only that is a consideration for Jaggers. Wemmick describes Jaggers,
Then, between his height and them, he slips in his subordinate—don't you see?—and so he has 'em, soul and body.”
The more that Pip witnesses, the more he begins to understand about the injustice of the justice system and why Jaggers has earlier alluded to the power of money when he announce to Pip his "great expectations." Pip understands that it is not ethical concerns that move Jaggers:
I was very much impressed, and not for the first time, by my guardian's subtlety. To confess the truth, I very heartily wished, and not for the first time, that I had had some other guardian of minor abilities.
When Pip and Wemmick exit the prison, Pip remarks that he yet smells its odor and feels its grime and dust. He wishes that he were not exposed to this place of human misery. As he stands reflecting upon his experience, a carriage passes and Estella is inside waving at him. Pip asks himself, "What was the nameless shadow which again in that one instant had passed?" foreshadowing the reappearance of Magwitch and the hidden past of Estella.
Pip's character is developed through his encounter with Newgate in at least two ways. He is exposed to corrupt motives for actions and stances in life; this occurs through his exposure to the actions and attitudes of Jaggers and Wemmick. His heart is shown as still soft and responsive to the suffering of others (the opposite of Jaggers and Wemmick), which sets the stage for his eventual humility and reconciliations with Joe and Estella.