Look for loose nails where the gaps are occurring, which could be the cause of gaps in the wood.
Pound in any nails that are sticking up using a hammer.
Replace any nails that are missing. In older houses especially, nails can become loose and then lost over time.
Inspect the wooden blocks set into the stair nose underneath the stairs, where the risers and treads come together. The wood blocks should be set into the stair nose firmly and you should not be able to wiggle them.
Pry away and remove any wood blocks that are loose using the claw end of a hammer.
Cover adjacent sides of a new wood block with wood glue.
Nail the wood block to the riser and tread using nails that will pass through the block, and part of the way through the risers and tread.