The attraction was unable to open the gates to hundreds of visitors at the usual time of 9.30am after it was left without any running water.
The burst water main also resulted in low water pressure in parts of the city.
The castle reopened at 11.45am after Scottish Water engineers repaired the pipe.
A spokeswoman for Historic Scotland said it was closed due to "health and safety reasons".
She added: "Earlier this morning Scottish Water informed us that a burst water main was resulting in low water pressure in the EH10-EH13 areas of Edinburgh and was also affecting EH1. Because of the high position of the castle, this meant that for a short period of time we had no running water, and had to close the castle for health and safety reasons."
Edinburgh Castle is Scotland's most visited paid-attraction, with more than 1.3 million visitors each year. Some 1400 people were expected to cross its drawbridge yesterday.