Macbeth is a play which follows the title character from his position as a beloved, valorous, and decorated (well rewarded) general to a debased and fallen king. In the beginning Macbeth is connected to Duncan as both a cousin and loyal subject; without Duncan's own words of praise and acts of commendation, Macbeth is not in the high position from which he must fall. (It's true that he becomes king, but that position is compromised because of how he got there.) That being said, Duncan can't last very long in the story because it's Macbeth's decline which is most significant. Both while he's alive and once he's dead, Duncan serves as the contrast for the paranoid and ruthless usurper king. Duncan has to be present, but he also has to die early so Macbeth has more time to descend.