In the climax of Harry Potter and the Sorcerer's Stone, Professor Quirrell touches Harry's forehead for a calculated reason rooted in Voldemort's plan.
Lord Voldemort's fragmented soul rides on the back of Quirrell's head, concealed by his turban. Quirrell is merely the vessel.
The Sorcerer's Stone is enchanted so only someone who wants to find it but not use it can retrieve it. Voldemort needs Harry to get it from the Mirror of Erised—then must touch Harry to take it.
The touch serves as a feint: Voldemort (through Quirrell) gets close enough to seize the Stone once Harry produces it, while Harry is distracted by the contact and pain.
Lily Potter's sacrificial love charm causes Quirrell's skin to blister and burn upon touching Harry—ultimately destroying Quirrell and forcing Voldemort's spirit to flee.
Quirrell's touch is Voldemort's calculated move to steal the Stone, not an act of aggression toward Harry personally.