Short answer: The drugs involved in HRT (as well as hormone level changes themselves) can cause sodium cravings, and pickles are salty. Somewhere along the line it became a meme.
Long answer: Pickles and Transfems: Hormonal and Cultural Food Craving in Gender Transition
(Thanks for asking the question, otherwise I never would have found this amazing article. I love it when people dive deep into silly things such as "trans girl pickle meme".)
Again and again, transphobes prove that their rhetoric of queer and trans people supposedly causing harm to children is nothing more than projection.
We need to protect kids from conservatives, not from trans folks and drag queens.