Is this problem also on the ceiling?
If not, then there may be a moisture problem in the walls.
What's on the outside of the house?
If it's brick, are there weeps at the bottom of the walls to let moisture escape?
If not brick, then is there space between the ground and the siding?
Moisture will wick right up a wall if it can't escape.
Vapors condense during the night when temps drop. the water that condenses inside the walls can't escape, so it soaks into everything. If the wood has been wet, it will cause staining directly onto the drywall and the staining will soak right through. The nails can rust, that can cause even more problems rusty nails releasing.. staining, breaking, pulling through.
Coat them with a stain-kiling primer like Kilz, It may take 2 coats, Then paint over.
BUT find the source of the problem first! Get that corrected, then paint