The pair was driven onto the beach by locals intimidated after previous encounters in which people have been killed
Two elephants were being led to safety Wednesday after crossing from Myanmar to Bangladesh, getting stranded on a beach and nearly dying at sea.
Separated from the rest of their herd, the male and female elephants waded across a river marking the border on Saturday, officials said.
Dwindling forests straddling southern Bangladesh and western Myanmar are some of the last remaining habitats of endangered Asian elephants.
One of their migration routes has been blocked since 2017 by refugee camps in Bangladesh housing hundreds of thousands of Rohingya who fled a Myanmar military offensive.
The pair was driven onto the beach by locals intimidated after previous encounters in which people have been killed, Fazlul Haque, councillor for the seaside town Teknaf, told AFP.
Elderly villager Jahid Hossain said residents had a "very bitter experience of losing crops and even lives to these elephants as they can become very aggressive".
Stuck on the beach for four days without food, and having attracted thousands of onlookers, the elephants swam out to the Bay of Bengal in a panic on Tuesday.
Fishermen had to carry out a dramatic rescue using boats and ropes to bring them back to shore.
"The fishermen rescued them from certain death in the sea," regional forest department chief Humayun Kabir told AFP.
On Wednesday, the pair was being led inland, Kabir said.
Locals tied ropes around the massive animals' necks to coax them into safety.
Raquibul Amin, country head of the International Union for Conservation of Nature (IUCN), said this was the fourth such incident since last year.
"We need a transboundary dialogue between Bangladesh and Myanmar to monitor the elephants so that we take measures to reduce human-elephant conflict," he added.
At least seven wild elephants have been found dead in the region since last year, according to the forest department.