Pip went home because he received a note telling him to go. He knew that it was risky, and a risk to Magwitch, but he went anyway because the note threatened Magwitch.
If you want information regarding your uncle Provis you had much better come and tell no one and lose no time. You must come alone. Bring this with you. (Chapter LII, p. 282)
The note was actually Orlick luring Pip back to get revenge. He had several reasons to want to kill Pip, not the least of which that he blamed Pip for getting him fired.
Orlick tells Pip that he has been following him. He was the one Pip stumbled over on the stairs. He knows everything. In the end, Pip is able to escape and is rescued by Herbert and Trabb’s boy, but Magwitch is still in danger.