It could be due to the headphone plug coming loose from the back of the computer. If the headphone plug is only halfway plugged in, you may only get 1 speaker out of 2 working.

Or, if the headphone cord is getting stretched or yanked accidentally, that could cause some damage to the wires inside the cord and may result in one of both of the speakers not working.

Another possibility is that the sound card in the computer has some electronic problem that is causing one of the headphone speakers to blow out. This is not very likely though.