You didn't share what application you are using in LibreOffice. I assume it is Impress, since you mentioned slides. But it works similarly with Writer.
Like shown in the screenshot below from the main menu use:
Insert > Header and Footer...
and Apply to All

Edit:
Using Draw there is no Header/Footer main menu item. But you can use
View > Master
and insert a field e.g. page number for your needs (Insert menu) like shown below. Go back to normal view.

Page numbers are apparently not displayed at the top, hidden by other objects (in the absence of transparency). The page numbers cannot be placed at the top either.
The only solution I can see at the moment is:
leave a free space for the page number at the desired position in all slides OR
enlarge the drawing area slightly at the bottom (or reduce the page margin at the bottom) and place the page number there in the master.
If necessary, the text size of the page number can be adjusted.
Format > Text > Decrease Size