Translation:How do you think he knew where you were?
Grammar wise I would say it is correct, thought "How do you think he learned where you were" sounds unnatural. I would say you only use learn when you are in school, or training etc. Also, the meaning is a bit different: He knew is a finished action, "he learned" implies a process he went through.
Certain verbs take on different meanings or different implications depending on whether they are used in the imperfetto or the passato prossimo.
Wouldn't this rule also apply to the congiuntivo?
Sapevo che Mario era sposato. = I knew Mario was married.
Ho saputo che Mario era sposato. = I found out that Mario was married.
Come pensi che lui abbia saputo dov'eri? =
How do you think he found out where you were?