The president also wished speedy recovery of the injured.
In her message of condolence, the prime minister prayed for eternal peace of the departed souls and asked the authorities concerned to take prompt and necessary measures to ensure better treatment of the injured, PM's Press Wing sources said.
The prime minister also conveyed deep sympathy to the bereaved families.
Sheikh Hasina is now in Doha, Qatar, and scheduled to return home Wednesday afternoon after attending the United Nations Conference on the Least Developed Countries.
A devastating explosion took place at the Siddique Bazar near BRTC bus counter at around 4:45 pm on Tuesday. Two adjacent buildings have been damaged. One is a seven-storey building while another is five storied. The basement, first and second floors of the seven storied building were damaged in the explosion.
Death toll in the explosion rose to 17 and over 100 others injured in the incident. Deaths of more people are feared from the incident.