Sounds like the switch in the headphone socket has gone faulty. When you insert a headphone plug into the socket it breaks a spring loaded switch connection to feed the sound to the headphones. Removing the plug usually remakes to switch feeding sound back to the speakers. Sometimes the contacts get worn. Try inserting and removing the headphones several times and see if it works. Of course there are some other possibilities but this is the most obvious.
Microsoft Surface Book 2 15in review