For Pip, loving Estella is like a prison because he is infatuated with her and cannot have her.
Miss Havisham traps Pip into falling in love with Estella when he is fairly young. She has him brought to her strange big house and introduced him to the pretty little girl at a very impressionable age.
Miss Havisham knew exactly what she was doing. She was trying to trap Pip, forcing him to fall for Estella and be ruined.
She drew an arm round my neck, and drew my head close down to hers as she sat in the chair. “Love her, love her, love her! How does she use you?” (Ch 29)
It works. Despite being ill-used again and again by both of them, Pip falls for Estella. She never really shows any encouragement, and when she is older she even tries to convince him that loving her is wrong.
“Moths, and all sorts of ugly creatures,” replied Estella, with a glance towards him, “hover about a lighted candle. Can the candle help it?” (Ch 38)
Estella tries to warn him that she has no heart, and can’t care about him the way he cares about her. He does not listen. He blames Miss Havisham when she decides to marry Bentley Drummle, when in fact it is Estella’s own idea. She wants to get back at Miss Havisham, even though she knows it means hurting Pip. She does care for him, as a brother, and tries to tell him that he is headed down the path of ruin.
It is not until much later, when Pip has been ruined and rebuilt himself, that he sees that she was right. Loving Estella was torture. She was a prison Pip could not escape.