NHS Lothian said 23 people had been treated in hospital and 12 people at the scene of the incident at Imperial Dock, Leith.
A major incident was declared after the research vessel Petrel became dislodged from its holding on a dry dock.
People have been asked not to attend A&E at Edinburgh Royal Infirmary (ERI) unless it is an emergency.
Pictures posted on social media showed the 3,000-tonne vessel, which is owned by the US Navy, leaning at a 45-degree angle.
The US Consulate in Edinburgh said it was monitoring the situation and offering support to US citizens who were involved.
"We thank the emergency services for their prompt response. Our thoughts are with all those affected by this incident," it added.
The Scottish Ambulance Service said it was called at 08:30.
Five ambulances, an air ambulance, three trauma teams, a special operations team, three paramedic response units and a patient transport vehicle were sent to the scene.
NHS Lothian said 15 patients were taken to Edinburgh Royal Infirmary by ambulance with another two attending themselves, four to Western General Hospital and two to Victoria Hospital in Kirkcaldy.
Another 12 people were treated and discharged at the scene.
A spokesperson for NHS Lothian said eight were still in the Royal Infirmary, some with "serious injuries", and outpatient appointments, endoscopies and planned surgeries had been cancelled to "free-up our surgical staff".
Jacquie Campbell, chief officer of acute services at NHS Lothian, said: "There are no plans at this time to postpone appointments or elective procedures tomorrow, but assessments continue and patients will be contacted directly if the situation changes."
NHS Lothian has advised other people who require urgent care to contact their GP or call NHS 24.
Police Scotland urged the public to avoid the area to allow access for emergency services.
Supt Mark Rennie said all casualties had been accounted for by 13:20.
He explained: "There is no risk to the wider public and inquiries are ongoing to establish the full circumstances of what has happened.
"I would also like to thank the public for their patience while the emergency services undertook a very difficult job aiding casualties."
HM coastguard sent teams from Fisherrow, South Queensferry and Kinghorn to the scene as part of the multi-agency response.
Scottish Fire and Rescue Service said it had sent four fire engines and "a number of specialist resources".
The Health and Safety Executive said it was aware of the incident and was making inquiries.
Sailors' Society Chaplain Pauline Robertson told BBC Radio Scotland's Drivetime she had been listening to port staff who had witnessed the incident or were dealing with the aftermath.
She said: "I think like everybody that has witnessed it or heard about it today, we're all just in shock and horror at the tragedy that just unfolded in front of us.
"There is shock, horror, pain - every emotion you can imagine is being shown by staff. "
The Sailors' Society also said it was supporting people affected by the incident.
"Our thoughts and prayers are with everyone affected by this morning's accident in Leith. Sadly many are seriously injured. We are supporting those we can."
James Welsh, 39, a scaffold foreman at Leith docks who was working near the Petrel as it fell, said he heard a loud noise but "not as noisy as you would think".
He said one worker he sees every morning had put down his bag to "nip to the toilet", and when he came back the ship was over and he didn't know where his work mates were.
"It's very scary - it just makes you evaluate everything," he said. "No one goes to work to be involved in any kind of accident.
"We all want to go home for our mince and tatties to our wife and kids so I feel for anyone who is injured, and their family."
Cammy Day, the leader of City of Edinburgh Council, said he was "deeply concerned" to hear of the incident, adding that emergency services were being supported to carry out their work.
Leith councillor Adam McVey described the incident as "terrifying" for those on board.
He said on Twitter: "Emergency services are responding to a major incident at Leith docks - a ship has been dislodged from its holding in strong winds.
"My thoughts are with those who've been injured and hope everyone recovers quickly. Please avoid area."
A spokesperson from Forth Ports said the incident happened at the facility of its tenant, Dales Marine Services.
They said: "We are providing Dales with any support we can today. We cannot comment any further as the incident response is being led by the emergency services.
"Our thoughts are with everyone involved in this incident."
Dales Marine Services, which runs the dry dock, said the incident with the Petrel began at about 08:00 and the emergency services were called shortly after.
A spokesperson said: "We can confirm that all those on board and at the facility have been accounted for and our priority is to ensure the wellbeing of all who have been affected."
A US Navy spokeswoman said: "We continue to communicate with our contacts at the scene in order to understand what occurred, the actions being taken, and the long-term impacts.
"Our thoughts and prayers are with those injured and their families, with hopes for a quick and full recovery."
The weather was windy overnight with gusts of up to 38mph (61km/h) recorded inland at Gogarbank at 08:00, according to Met Office data.
Iraklis Lazakis, from the department of marine architecture and engineering at the University of Strathclyde, said it was a "very, very unusual" incident.
He told BBC Scotland's The Nine he believed the strong winds were unlikely to be the root cause of the incident.
Leith dock, in the north east of Edinburgh, has a maritime history going back many centuries and is now home to the decommissioned Royal Yacht Britannia.
The privatised Forth Ports has the largest enclosed deep water port in Scotland and has been selected to develop one of Scotland's first green freeports.
The 76m (250ft) ship has been owned by the United States Naval Facilities Engineering and Expeditionary Warfare Center since October 2022, and operated by Oceaneering International.
The vessel was previously owned by the estate of Microsoft co-founder Paul Allen.
It was placed into long-term moorage in 2020 as a result of "operation challenges" during the Covid pandemic, and has not been used since.
Before this, it had been used for deep water searches for shipwrecks and war graves at sea, including the lost World War Two heavy cruiser USS Indianapolis, which was discovered 18,000 feet (5.5km) beneath the surface.
The RV Petrel was fitted out for the specialist searches before billionaire Mr Allen died in 2018, having already pledged to commit most of his fortune to philanthropy and non-profit scientific research.