The Turkey's constitutional court challenged the charges, saying they violated freedom of the press, they won the case and were both released early on Friday after three months in jail.
Large crowds chanting support met them outside prison on their release.
"This is a trial of press freedom," Mr Dundar said. "We got out but more than 30 colleagues are still in prison. I hope that this ruling will pave way for their freedom as well."
"We would continue to fight for press freedom until this concentration camp that you see behind me becomes a museum".The court, which ruled on Thursday agreed that their "rights to personal liberty and security had been violated and that the decision was overwhelmingly approved with 12 votes for and three against, Turkish media reports said.