The mother and child are in good condition following their release on Wednesday, the ministry said in a statement.
It added that the pair, who were not identified, were safely under the care of German consular officials in Turkey.
"The German citizen and her child are doing well, under the circumstances," a spokesperson for the foreign ministry told the German news agency dpa.
The spokesperson said a unit of the federal government had "made considerable efforts to solve the case."
Embassy officials were helping the woman and toddler to prepare to return to Germany.
German daily "Bild" identified the woman as Janina F, a freelance journalist, who worked for the "Süddeutsche Zeitung" newspaper and broadcaster "NDR."
In a report on her disappearance in February, "Focus" magazine described how the 27-year-old had been kidnapped in October 2015 by the al-Nusra Front militant group, and gave birth to her son in December.
The militants allegedly demanded 5 million euros in ransom. It is unclear if any money was paid.
The German government's policy is to not pay ransoms for hostages.
The woman's disappearance was not made public, under foreign ministry guidance.
Media rights groups have said that more and more journalists are being kidnapped or attacked while working in conflict zones.
mm/jm (AP, AFP, dpa, Reuters)