Neither is good. We don't ask questions of or to people.
- You can ask favors of people.
- You can tell answers to people. You can tell stories to people.
- You can pose questions for people.
I would say it this way: "When he was asked this question, . . . ."
Or even better: "When I [or he, she, we, or they] asked him, . . . ."
Student or Learner