The Midrash (Tanchuma 24) teaches: "A human smites with a knife and heals with a bandage. But Hakadosh Baruch Hu heals with the same matter He used for smiting. This is what happened in Marah (Shemos 15:22-25). The waters of Marah were bitter and undrinkable. Moshe figured Hashem would tell him to throw in honey or dates to sweeten the water. However, take a look at the verses (Exodus 15:25) and see what happened:, Moshe shouted to Hashem and Hashem showed him a tree…' Hakadosh Baruch Hu told Moshe, 'My ways aren't the same as human beings'" because Hashem sweetens the bitterness with bitterness. People go through hardships in life. Sometimes, it is very hard and painful. Nevertheless, those moments can be called bittersweet, because those bitter moments end up sweetening our lives. This is the lesson of Marah. Hashem was teaching Moshe His ways [that He cures bitterness with bitterness].
What tree was it? Reb Yehoshua says it was a willow. Reb Eliezer HaModo'i says it was an olive tree. Others say it was the roots of a fig and pomegranate. According to all opinions, it was bitter wood. Reb Shimon ben Gamliel said, 'Come and see Hashem's wondrous ways; far more wondrous than the ways of human beings. A human cures bitterness with sweetness, but Hakadosh Baruch Hu cures bitterness with bitterness… Hashem makes a miracle within a miracle. Similarly, it states (Yeshayah 38), "Yeshayahu said take figs, and smear it onto the boils and you will live.' We know that figs irritate wounded skin. But Hashem cures with something that harms, to perform a miracle."
The Midrash also brings the following source (II Kings 2:18-21): "The people of Jericho said to Elisha, 'It is a good place to live, but the water is bad, and people are dying.' Elisha told them, 'Bring me a jug with salt.' They brought it to him. He went to the water's origin, threw the salt there, and said 'So says Hashem, I heal this water. There won't be any more deaths.'" The Midrash asks, "Behold even good water becomes ruined when you put salt into it. Nevertheless, Hashem performed a miracle within a miracle, and something that ruins water cured the water. Hakadosh Baruch Hu told Moshe, 'It isn't My way [to cure bitterness with sweetness] rather, I heal with the same item that I smite with. The waters of Marah are bitter, so I will heal them with something bitter." This idea gives encouragement and hope for all those who are going through bitter and difficult times. Believe that this bitterness will bring about sweetness, because Hashem heals bitterness with bitterness.
It states (15:9-10), "The enemy said, 'I will chase after them. I will catch up with them. I will divide up their bounty…" Why are we praising Hashem for that frightening moment? And why should these words be part of the shirah (Song at the Sea)? Pharaoh's plan to destroy them doesn't seem to be something to sing and praise Hashem for! But something very sweet came from this bitter situation. Pharaoh was bringing himself and his army to the sea, where they will drown. The Ramban asks that this verse about Pharaoh's plot to chase Bnei Yisrael) should be written at the beginning of the shirah, since that's the beginning of the story. Perhaps, at the beginning of Oz Yashir the nation wasn't yet able to praise Hashem for that hard, bitter moment, when Pharaoh was plotting to destroy them. But after they said a few verses of the shirah, and they began to recognize the wonderful miracle Hashem performed for us, they could look back and recognize that even that bitter moment was for their benefit. Now they can sing and praise Hashem for that moment, too.
Rabbi Elimelech Biderman, shlit"a