The -re ending in British English spelling derives from French -re. However, most French loanwords originally ending in -re in Old/Middle French or Anglo-Norman had their spelling changed to -er in modern British English, for example number, order, letter, chapter, member, offer, minister, monster, oyster, tender, proper, September, etc.
Why then did the -re spelling persist in a minority of words, such as centre, fibre, sombre, lustre, saltpetre, theatre, meagre, etc., in British English? Were the -er spelling variants of these words just somehow not common enough in Middle English for later lexicographers to adopt the -er spelling as the standard for these words?