I saw the Messenger of Allah (ﷺ) praying both barefooted and wearing sandals.

Sunan Abi Dawud Book 2, Hadith 263