Meaning: to run away from a dangerous or an unpleasant situation.
The term originally referred to the military practice of beating drums to call back the troops.
But presently it is used for withdrawal from any kind of situation.
1)As soon as we saw the police arriving, we beat a hasty retreat.
2)We wanted to go shopping but we had to beat a retreat when it started to rain.