"Everywhere Marie Yovanovitch went turned bad," Mr Trump wrote. "She started off in Somalia, how did that go?"
He said it was "a US President's absolute right" to appoint ambassadors.
Replying in real time, Ms Yovanovitch called it "very intimidating".
Her response - at the invitation of hearing chairman Adam Schiff - was broadcast live during the televised testimony.
Mr Schiff, the Democratic Chairman of the Intelligence Committee overseeing the impeachment inquiry, suggested the president's tweets could be classed as witness intimidation.
The inquiry is currently investigating whether Mr Trump withheld US military aid to Ukraine in order to pressure the country's new president to announce a corruption inquiry into former Vice President Joe Biden, now his rival for the US presidency.
Mr Trump denies any wrongdoing and has branded the proceedings "presidential harassment".
Ms Yovanovitch was removed as ambassador to Kyiv in May. In earlier closed-door testimony, she alleged she had fallen victim to a smear campaign at the hands of Mr Trump's personal lawyer Rudy Giuliani.
She said Mr Giuliani had started working to discredit her while attempting to push Ukraine into two investigations that would benefit Mr Trump.
Responding directly to the president's tweet in which he appeared to blame her for upheaval in Somalia, Ms Yovanovitch replied: "I don't think I have such powers, not in Mogadishu and Somalia and not in other places."
"I actually think that where I've served over the years I and others have demonstrably made things better, you know, for the US as well as for the countries that I've served in," she said.
Trump makes his presence felt
Donald Trump has boasted that his conduct while in office - blunt language and shoot-from-the-hip tweeting - is "modern-day presidential". If so, welcome to a modern-day presidential impeachment hearing.
Just over an hour into Marie Yovanovitch's testimony, Mr Trump launched the kind of Twitter fusillade that has become a regular part of his political repertoire. He questioned the ambassador's competence, noted that the Ukrainian president spoke unfavourably about her and pointed out that he has the right to fire diplomats at will.
What makes the moment historic is that Committee Chair Adam Schiff gave Yovanovitch a chance to refute the president's tweet almost in real time.
Democrats are already characterising the president's behaviour as witness intimidation - and the latest attack by the president against one of his own government employees. Republicans, whose reported strategy was to avoid directly impugning the reputation of a long-serving, well respected diplomat, will once again find a president who has changed the rules of engagement on the fly.
On Wednesday, the White House said the president was not watching the impeachment hearings. On day two, the president is fully engaged.
Mr Trump may not be in the hearing room, but his presence is being felt.
What was the response to Trump's tweets?
In a break during the hearing, chairman Adam Schiff called the president's tweets about Ms Yovanovitch an effort to "chill" her and other witnesses who might come forward.
He told reporters the ambassador had been "smeared" and "recalled for no reason", and was now experiencing "witness intimidation in real-time by the president of United States".
Ken Starr, who served as special prosecutor during the impeachment of President Bill Clinton, said Mr Trump's comments showed "extraordinarily poor judgement".
But Republicans rejected the intimidation claim. "The witness is testifying. She wouldn't even have known about the quote, if Mr Schiff hadn't read the tweet," Representative Jim Jordan said.
More about: Trump