"Maybe he had taken you for a foreigner."
Translation:Forse lui ti aveva preso per uno straniero.
In the DL tradition, yes. However, in reality, the English sentence specifies "he" so you know that the confused party is male. If you suppress the "lui", you are removing that piece of information from the Italian version.
In a situation in which a man and a woman are asking for your friend's papers in Italy and she risks being forcefully deported to Turkey even though she is Italian, it might be important to know which one of the two agents is confused about her being a foreigner. ;)