You have a great question, and one that is not often asked when discussing this story. He could have left, as most of the town thought, and Miss Emily would have gone one much as she had, a sad and pitied old woman who was the focus of old gossip. But what kind of gothic story would that have been?
Homer had to die because his death creates one of the greatest twists in literature. Here is this woman who epitimizes the genteel southern woman. She teaches china painting. Her father was a mean-spirited man who made sure that no man would brave the front porch to court her. She was pitied by all the women in the town who knew that "poor thing," she would never marry.
Then, when Homer comes to town, and she is seen with him in the buggy, she becomes the object of scorn. The cannot pity her anymore because she is acting against the mold that they expect of her. Without her father's influence, she has "gone wild."
When Homer leaves, and she retreats into her home, rarely leaving it, the town can return to its pity for her. They can send their daughters to her for painting lessons because it is the least they can do for the poor thing.
If it were not for the death of Homer, she would be what they thought that she was -- a pitiful example of a woman who was bullied by her father, sullied by a man beneath her in social rank, left alone to die with only the company of a servant.
Homer had to die, or we would be left without a story. Miss Emily was not someone to be pitied, nor as they found out after her death, was she someone who accepted her fate without recourse. Homer may have thought to leave her, but Miss Emily was not one to be left by the last hope she had of a man.