At that point in time, everyone shows averse to mete out Salim, so, it is mandatory to the Emperor to do so but he collapses due to the affection of his son. Being cognizant of Anarkali entombment, Salim rushes to save her when Gulnar backstabs him, by the time he reaches there, Anarkali is already buried.
At that point in time, everyone opposed Salim's punishment, so the Emperor was duty-bound to carry it out but he succumbed due to his son's love. Conscious of Anarkali's burial, Salim rushed to save her when Gulnar betrayed him, by the time he reached her grave, Anarkali had already been entombed.