The workers, aged 64, 57 and 23, were understood to have been using hydrochloric acid to clean the facility at Leith Docks when one of them collapsed as a result of breathing difficulties.
As many as ten emergency vehicles went to the scene, and firefighters wearing breathing masks pulled the men to safety.
They were treated outside before being taken by ambulance to Edinburgh Royal Infirmary as a precaution.
The incident happened at the premises of Bredero Shaw, a pipe-coating manufacturer which operates out of the docks.
A spokeswoman for Lothian and Borders Fire and Rescue Service said: "We were called to Leith Docks by the ambulance service just before 9am today.
"Three men had been using an acid cleaner in one of the toilet blocks and one had begun to feel unwell. He was treated at the scene for respiratory problems and a second man also appeared to be overcome by the fumes.
"All of them were taken to the Royal Infirmary of Edinburgh to be checked over."
She added: "The product was moved outside and the block was aired out."
Fang Lin, who runs a burger van at the dockyard gate, said he had seen "at least ten" emergency vehicles rush to the scene.
He said: "I saw them come in at about half past eight.
"I heard a guy say people had put chemicals down the toilet and it gave off poison and when people went in they couldn't breathe."
Lothian and Borders Police confirmed the casualties as males, aged 64, 57 and 23.
A police spokesman said: "Three men inhaled a chemical substance which they were using in the course of their work.
"They were taken to Edinburgh Royal Infirmary as a precaution."