When Maedhros and Maglor learned of a Silmaril in Elwing's possesion, they attacked the Mouth of Sirion and killed everyone but Elrond and Elros. Elwing had jumped into the sea and rejoined her husband Earendil, so why would she leave them at the mercy of the sons of Feanor instead of taking them with her?
It was the only way to end the curse on the silmarills
Tolkien, in a letter to Milton Walden (included in the Silmarillion) states:
But the curse still works, and Eärendil’s home is destroyed by the sons of Fëanor. But this provides the solution: Elwing casting herself into the Sea to save the Jewel comes to Eärendil, and with the power of the great Gem they pass at last to Valinor.
So her sacrifice helps enable the end of the curse of Feänor and allows her and Eärendil to pass into west and ultimately leads to the destruction of Morgoth.
We don't know if she knew she would be lifted from the sea and could have assumed death was coming. Better to leave her sons with a chance of life than kill them.