Trump tweeted, sharing the L.A. County Sheriff's tweet showing video of the shooting:
"Animals that must be hit hard!"
The sheriff's office reported protesters outside the hospital were chanting "we hope they die."
Trump added in another tweet:
"If they die, fast trial death penalty for the killer. Only way to stop this!"
Los Angeles County Sheriff's Office posted a series of tweets on the shooting, saying the suspect remains at large and the two deputies are in critical condition and "fighting for their lives" after surgery for multiple gunshot wounds.
The first tweet came just before midnight ET last night:
"Moments ago, 2 of our Sheriff Deputies were shot in Compton and were transported to a local hospital. They are both still fighting for their lives, so please keep them in your thoughts and prayers. We will update this thread with information as it becomes available."
"Update: One male deputy and one female deputy were ambushed as they sat in their patrol vehicle. Both sustained multiple gunshot wounds and are in critical condition. They are both currently undergoing surgery. The suspect is still at large."
The tweeted video of the shooting followed:
"The gunman walked up on the deputies and opened fire without warning or provocation."
Among the protesters at the hospital was a "member of the press" that rushed officers who were trying to arrest a male protest who refused to disperse, according to the sheriff's Twitter.
Law and order has been a pressing Trump campaign issue in both of his election cycles, with a rash of shootings of police officers in 2016.