Is there an expression that means something bad as a precursor to something good?
If a couple is trying to get pregnant, and the wife gets morning sickness, which potentially heralds wonderful news for the soon-to-be-parents, the wife's morning sickness is what we French refer to as "Un mal pour un bien," lit. out of bad comes good.
So, what sounds to come the closest here is "There is no rose without a thorn" or "It's an ill wind that blows no good."
There is no rose without a thorn: Prov. to enjoy any beautiful or pleasant thing, you must endure something difficult or painful.
It's an ill wind (that blows no one any good): A misfortune usually benefits someone.
The OP is asking for an expression, but also has a tag for a single-word request.
As far as the expression goes, there's a proverb: "It's always darkest before the dawn."
"every cloud has a silver lining" - even though it's bad there is a good side to it
"a blessing in disguise" - looks bad but in reality is good
Here's an expression that might fit:
Take one step back to take two steps forward
This implies that something bad happened that made it seem like you were losing progress, but that it turned out that this was a necessary event that enabled real progress.
There are many more phrases like the ones already given; for example "When God closes a door He opens a window" and "After the darkness comes the dawn."
However, these generally are used when someone is unhappy over a present situation, and one wishes to give a reminder that "something good is just around the corner." This is close to the idea of putting up with morning sickness for the reward of a child, but there's the sense in all of them that the good result is an unknown one, that one takes it on faith that something good comes out of something bad.
To my mind, "every rose has a thorn" probably comes closest to the meaning that you are looking for. It has more of the flavor of something known and worthwhile having a bit of pain associated with it.
Nobody has mentioned (perhaps for good reason) "no pain, no gain." This is a phrase generally used by people who work out to improve their physique to encourage themselves to work harder, so it would be a bit of a joke. I can't say whether I would find it funny if I had the morning sickness, but I might!