Toronto Fire Services said the two men were buried about 2.5 metres deep at the site in North York. One of the workers was completely buried.
The men were freed shortly after 2 p.m. and no serious injuries were reported.
Firefighters had to work carefully to dig the workers out in order to avoid causing further collapse or getting trapped themselves.
A specialized truck and hydraulic equipment were brought in around 1 p.m. Fifteen trucks and 60 firefighters were also on scene.
The site is located in a residential area near Bayview Avenue and York Mills Road.