On Friday, the court handed the life sentences to the six defendants for “seeking to overthrow the constitutional order by force,” the state-run Anadolu news agency reported.
All six, three of whom have already been imprisoned for nearly 17 months, have denied the charges.
Prominent Turkish journalists Nazli Ilicak, Mehmet Altan and his brother Ahmet are among the defendants.
Turkey’s highest court, the Constitutional Court, had previously ordered the release of Mehmet Altan, saying the detention violates his rights, but the penal court dismissed the request.
The Altan brothers were accused of giving coded messages on a television talk show a day before the coup.
“Whatever the developments were that lead to military coups in Turkey, by making the same decisions, [President Recep Tayyip] Erdogan is paving the same path,” Ahmet Altan had said at the TV show.
On the same program, Mehmet Altan pointed to “another structure” within the government that was monitoring the political developments in the country to “take its hand out of the bag.”
Prosecutors say the comments were coded messages to followers of US-based opposition cleric Fethullah Gulen, whom Ankara accuses of masterminding the putsch.
“This sets a devastating precedent for scores of other journalists charged with similarly groundless charges,” said Sarah Clarke of writers organization PEN International.
The lawyer for the Altan brothers, Ergin Cinmen, told Reuters that they would appeal against the verdict, saying, “This is a trial that wiped out freedom of thought.”
“This verdict will be definitely reversed. Turkey cannot go on with this verdict,” he added.
'Unprecedented assault on freedom of expression'
The verdict drew fierce criticism from international organizations and rights groups, including the UN, which urged Turkey to reverse the ruling.
”These harsh sentences are an unacceptable and unprecedented assault on freedom of expression and on the media in Turkey,” the UN human rights office said in a statement.
During the botched putsch in July 2016, a faction of the Turkish military declared that it had seized control of the country and the government of Erdogan was no more in charge. The attempt was, however, suppressed a few hours later.
Turkey, which remains in a state of emergency since the coup, has been engaged in suppressing the media and opposition groups suspected to have played a role in the failed coup.
Tens of thousands of people have been arrested in Turkey on suspicion of having links to Gulen and the failed coup. Nearly 150,000 others, including military staff, civil servants and journalists, have been sacked or suspended from work over the same accusations.
The international community and rights groups have been highly critical of the Turkish president over the massive dismissals and the crackdown.