Correct option is A
Option (a) is the correct meaning of the given idiom.
Beat a retreat: to withdraw quickly, especially when faced with a dangerous or unpleasant situation.
Example: When the enemy troops advanced, our soldiers had to beat a retreat.