On a high level I understand for a balanced data set we should use precision, recall and if dataset is imbalanced we should use sensitivity and specificity. but I am not sure why they say it.
Could you please give a reference where did you get this information? For imbalanced data sets, all the measures that you have mentioned can be used, but you should avoid reporting accuracy, since it can be very misleading.
As @Frank Harrell already mentioned in his answer, the logistic regression model models probability, but it can be used to make a binary classifier, by thresholding the probability.
All the measures you mentioned (sensitivity, specificity and precision, recall) can be used for evaluation of binary classifier performance. All these measures are based on 2×2 contingency table or confusion matrix, also known as an error matrix.
To decide what measures to use, you have to think about what cells in the confusion matrix are important to you. For example in information retrieval, true negatives can be usually ignored. But in medical diagnosis usage, true negatives are also very important and that is why specificity is used instead of precision. Also note that sensitivity = recall.