In the story, Bonaparte (the narrator) and his compatriot, Noble, watch over two English prisoners, Hawkins and Belcher. The British soldiers enjoy a good camaraderie with their Irish captors; all are on friendly terms, and the soldiers even play cards together.
The exchange between Hawkins and Bonaparte is used by the author to demonstrate the friendly rapport the English captives have with their Irish captors.
"You're the bloke they calls Bonaparte?' he said to me. 'Well, Bonaparte, Mary Brigid Ho'Connell was arskin about you and said 'ow you'd a pair of socks belonging to 'er younger brother."
O' Connor also includes this exchange to highlight the difficult situation Bonaparte and Noble find themselves in later on in the story. When orders come in to execute both Hawkins and Belcher, Bonaparte finds himself ambivalent. He feels only guilt that he must now execute men who he has come to regard as fellow human beings. Additionally, Belcher's dignity and kindness in the face of death adds to Bonaparte's guilt and sense of shame.
...I was somehow very small and very lonely. And anything that ever happened to me after, I never felt the same about again.
So, O' Connor includes the exchange about the socks to highlight the difficult moral decisions every soldier must make in the act of warfare. To undergird his point, he skilfully juxtaposes the humanity of the soldiers' earlier interactions with the inhumanity of the orders that are sent from superior officers.