Officers attended the Royal Edinburgh Hospital in the Morningside area of the city at around 4pm today.
It was described as an "isolated incident".
A huge police operation was mounted with dozens of police, including armed officers, and a helicopter over the site. Local people were told to stay indoors as inquiries continued.
Superintendent Kenny MacDonald said: "Police cordoned off an area around the Royal Edinburgh and Astley Ainslie Hospital while inquiries were carried out.
"The injuries of the two people, a man and a woman, are not life threatening.
"I'd like to thank the public for their patience during this time."
Tim Montgomery, director of operations, Royal Edinburgh Hospital and Associated Services, NHS Lothian, said: "We can confirm that an incident took place in the grounds of the Royal Edinburgh Hospital earlier today.
"This was an isolated incident and no other patients or staff were injured. Patient safety remains our main priority and we will continue to help Police Scotland with their inquiries."