Why does the pitch of my MacBook Pro changes when i plug something off the headphone jack?
Try opening the Audio MIDI Setup app

and adjusting the Format of the External Headphones or the MacBook Pro Speakers so they're the same sample rate (48,000 Hz in this screenshot).

Mine were not the same.