In most laptops the headphone jack includes shunts or switches that automatically disconnect output to the speakers when headphones are connected. If that used to happen but now doesn't then something has changed in either the jack or headphones. These connections (or disconnections) depend on a phone connector
(aka phono plug) with the proper tip configuration. Make sure you are using stereo headphones and not cellphone or other types of earpieces.
If that doesn't help then it is possible the jack itself has gone bad. You could try cleaning it with contact cleaner. If that doesn't help then replacing the jack would be the next option. In many laptops the audio jacks are contained on an auxiliary board that you can purchase as a spare part
, or you could remove and replace the jack from the board. Since the latter would require soldering, unless you could do it yourself the cost to have it done may be prohibitive. Scott.