From the website of Iran's Supreme Leader Ayatollah Khamenei:
The Leader of the Islamic Revolution—Ayatollah Khamenei— met with teenaged international chess medalist, Ariyan Gholami, who refused to play against a representative of the Zionist regime in a recent international chess competition. In this meeting held today February 24, 2019, the young medalist presented his medal to Ayatollah Khamenei.
The following is the text of a conversation that took place between the Supreme Leader and Aryan Gholami:
Imam Khamenei: Did you join the national team?What a natural-sounding conversation!
Gholami: yes, thanks to you. I am grateful.
Ayatollah Khamenei: Thanks be to God. May God protect you, and the youth like you. May God preserve you for Islam and for this country. Is this gentleman your father? And this lady is your mother? May God protect this young man for you [his parents]. I hope he will make you feel proud in this world and the hereafter, God willing.
Gholami: I would like to offer you my medal.
Ayatollah Khamenei: Wonderful! You made me really happy Mr. Gholami, dear Ariyan. I am happy to have you, and other youth like you, thanks be to God. For the country’s future, you are the best assets; keep these assets.
Gholami: Thank you very much. It is kind of you.
Ayatollah Khamenei: I accept your medal and then, I return it to you. I would like you to keep this medal.
In reality, Gholami didn't have a choice, and was miserable at having to not play his match in early January.
In 2017, Borna Derakhshani, a 14-year old chess player, was banned by Iran Federation forever for playing against an Israeli player.
This Swedish chess site says:
Aryan Gholami tells schack.se that he has no personal antipathy against the Israeli Ariel Erenberg.An Iranian human rights group released a caricature showing how Khamenei forced Gholami to withdraw.
"But if I were to play against an Israeli, it would have serious consequences for me."
Gholami quickly learned that he has to pretend to be a good patriot instead of a frightened pawn.
The Swedish site also revealed that tournament organizers routinely try to set up the draws in such a way to avoid any matches between Israelis and Iranians, and the international chess federation FIDE looks the other way when this happens, to avoid controversy.