The navy said the pair of wild elephants were brought ashore after a "mammoth effort" involving navy divers, ropes and a flotilla of boats to tow them back to shallow waters.
Photos showed the elephants in distress, barely keeping their trunks above water in the deep seas about one kilometre off the coast of Sri Lanka.
"They were extremely lucky to have been spotted by a patrol craft which called in several other boats to help with the rescue."
Navy officials say the animals were likely swept out while crossing shallow lagoons in the region. They are not the only wildlife to encounter trouble in the biodiverse island. In May, the navy and local residents saved a pod of 20 pilot whales that became stranded in Trincomalee, a natural harbour that is popular for whale watching.
The waters around Trincomalee, which were used by Allied forces as a staging post during World War II, have a high concentration of blue and sperm whales, while the surrounding jungles have herds of wild elephants.
Watch the dramatic rescue here
Click for more trending news