We use either of these expressions to express the idea that we are preparing something that will be the base of what is to come later.
Lay the groundwork comes from construction, when a foundation must be laid before a building can be built.
Sowing the seeds comes from agriculture, referring to when the seeds are placed in the ground so they can grow and then be harvested later.