At least 63 people on board suffered less serious injuries, police said. They said there were about 150 passengers on board the two trains.
The crash occurred shortly before 7 a.m. Tuesday local time near the spa town of Bad Aibling, about 60 kilometers (37 miles) southeast of the Bavarian capital of Munich.
The trains collided at a bend on the Mangfall Valley Railway, a single-track regional rail line between the towns of Rosenheim and Holzkirchen, German Transport Minister Alexander Dobrindt said.
"There's a curve there, so we must assume that the train drivers must not have been able to see each other beforehand," he told reporters at a news conference.
One of the trains had "drilled" into the other, he said, leaving a carriage "totally dismantled."
He described the scene as a "horrible picture," saying it was estimated the trains had been traveling about 100 kph (62 mph) at the moment of impact.
"This is a difficult hour for the railways in Germany," said Dobrindt, describing the crash as "one of the biggest we have had for years."
"We cannot imagine that such an accident can happen here," he said.
The two drivers of the trains appeared to be among the dead, although identification of the victims was still in progress, according to a statement from Transdev, the parent company of train company Meridian.
Upper Bavaria police tweeted Wednesday that no passengers were unaccounted for. Police had earlier said that they believed as many as two passengers were missing.
'We really have no clue'
How the two trains came to be running directly toward each other on the same track is still unclear, authorities say, and they are reluctant to speculate too much before data recorders are analyzed.
But investigators appear to be focusing on human, technical or infrastructure errors as possible causes, rather than other factors such as terrorism.
A criminal investigation into the collision is being led by the public prosecutor in Traunstein, Germany, a police spokeswoman told CNN.
Two of the three data recorders on board have been recovered so far, and it was expected that the third would be recovered from the wreckage, said Dobrindt.
Christian Schreyer, board chairman for Transdev, told CNN that it was baffling that the crash could have occurred.
"We really have no clue how this could happen," he said.
Automatic braking system
Authorities say the railway was equipped with an automatic braking system that would stop trains from running on a track where they were not supposed to be.
The safety system was implemented across the country's railways after a 2011 crash in the town of Oschersleben
, in eastern Germany, in which 10 people were killed, said Dobrindt.
Both trains in Tuesday's crash had both a driver and a driver instructor on board, said Schreyer. It would be extremely unlikely for both the driver and driver instructor on a train to miss a red signal -- and then for the automatic braking system not to kick in, he said.
"We assume that those signals were green, but we don't know yet," he said.
Bavarian Interior Minister Joachim Herrmann said at the news conference that at least one of the trains was not running to schedule. "Why they did not stick to the timetable, we don't know. This has to be investigated," he said.
Schreyer said trains were permitted to run at 120 kph, or just under 75 mph, on the line, and he believed they were moving at some speed when they collided.
"I don't think that (they) were on full speed, but looking at what has happened, they have been not very slow, let's say it that way," he said.
"It's really, really rare. We've been running the trains here for 12 years, and we've never had an accident yet."
Austrian emergency services called in
More than 600 police and rescue workers -- from Germany and neighboring Austria -- scrambled to the crash scene, which is in a hilly, forested region. Dobrindt said police were on the scene within minutes of the crash.
Helicopters and boats ferried the injured to hospitals and clinics. Authorities said it took about three hours to remove the victims from the scene.
Medical authorities have issued an urgent call for blood donations to help treat the injured, and counselors are being deployed to assist victims and their families. Dobrindt said that emergency workers would also need counseling for what they had faced.
A journalist at the scene, Stephan Richter of German broadcaster RTL, told CNN that the Mangfall Valley Railway was one of the most important lines in the region, used by workers commuting from Bavarian villages to Munich.
It was a small mercy that the train was not as full as it usually would be, because of a school holiday for the annual Carnival celebration, he said.
"We can only pray right now that the train was not packed out like on a regular basis," he said.
German Chancellor Angela Merkel said in a statement Tuesday that she was shocked and saddened by the disaster. "My sympathies go out especially to the families of the nine people who lost their lives," she said.