Desiree's death is necessary for her because she feels the shame and pain of her unknown origins and therefore believes that she is the reason that the baby has African features. Desiree's own feelings of inadequacy are what spur her to take the drastic action of walking into the swamp with her baby. Armand's rejection of her and the child in conjunction with her own feelings of worthlessness combine to create the environment for this tragic decision.
She did have another option, she could have gone home to her mother, Madame Valmonde who was eager to take both her and the child. However, Desiree has been so happy with her husband that she cannot imagine any life without him.
Armand, who has a superior attitude toward everything in his life, treating everyone like a possession, rejects his wife and child when his African heritage begins to emerge.
"Armand cruelly casts aside his wife and son, for they now have no worth to him. The unexplored irony of the story rests in his realization that it is he, not Désirée, who has African blood."
Desiree believed that she had no other course of action, going home to her mother would not help her with her feelings of loss of the love of Armand. She believed that her life was over if Armand did not want her anymore. So there was no place for her to go, that is why she committed suicide. She took the child with her to save him from the rejection that he would experience from a father who did not love him.