These abbreviations represent the Latin phrase ante/post meridiem, which mean 'before/after midday'. They have been in use in English since the 17th century.
If, after browsing the FAQs, you still can't find the answer to your question then submit your query to the AskOxford Language Query team.