When I start the game on my computer with my headphones unplugged, and plug them in afterwards, the audio sometimes don't change to my headphones, and stay on the silent speakers. Is there a way to reset the audio without restarting the games? Currently this is about borderlands 2, but I know other games have this problem too
It usually depends entirely on the game in question. Possibly also on your sound card and hardware too, but mostly the game.
Usually your sound card and your headphone port are represented as different devices, even though they're running to the same card. If your game has an option to direct sound to a specific audio device, changing this option in game will usually fix your problem. Even if it's already on the device you want, changing it off and then back can fix it as well. Most games seem to have to reacquire the hardware when you do this, so it acts like a soft reset on the sound engine.
That said, Borderlands 2 definitely doesn't have such an option for sound devices. I've run into this same issue myself, and my solution there is to check where my default audio is and then simply restart the game.