One of the children, an unidentified 12-year-old boy, was burned on the right hand, said the spokesman, Sam Zambuto. He was conscious and taken to Good Samaritan Hospital Medical Center in West Islip for treatment.
The second child was burned on his left arm and taken to the same hospital.
Two auto mechanics, Christopher Briscoe and Ibrahim Duman, whose shops are across the street from where the accident occurred -- at Long Island Avenue and South 27th Street -- said the 12-year-old boy had fallen face down on the tracks and was unable to move.
"I noticed the kid's foot was stuck and twisted between the rails," said Briscoe. "There was blood running down his nose."
The men said they lifted the boy up and carried him to the base of a nearby staircase and waited for help to arrive.
About 15 to 20 minutes later, the men said, a train came barreling through. "That boy is lucky to be alive," said Duman.
The boy was accompanied by two friends, Duman and Briscoe said. The men said one of the boys said the group was walking home from school and crossed the train tracks, via a cut in the fence, instead of using the overpass.
One of the boy's friends emerged from the hole in the fence, waving his arms and screaming for help, the men said. "He was screaming 'My friend, he's not moving,' " Duman said. "That skinny kid deserves all the credit."
Duman, co-owner of Bestway Auto Repair, and Briscoe, owner of Royalty Auto Repair, said many people use the hole in the fence instead of the walkway. The men, who said they had been in business for more than a decade, said the hole has been there for "a while."
"Every time they fix it, somebody cuts it," Briscoe said.
The LIRR said in an email that the accident is "currently under investigation and will include a review of the fencing in the area. The LIRR hopes the children make a full and quick recovery from their injuries."