**Yes—you can buy a Pendik–Ankara ticket at the station on the day of travel, if seats are available.** You will still need to choose a specific departure. If that train is full, you’ll need another service. [Seat 61’s Turkey guide](https://www.seat61.com/train-travel-in-turkey.htm#how_to_buy_tickets)

- **Seats:** Waiting gives you fewer choices and risks a sold-out train. If you must reach Ankara that day, booking ahead is safer.
- **Price:** TCDD has historically used fixed fares for a given journey and class, so buying on the day generally carries no last-minute surcharge. I couldn’t verify its current pricing policy; check the amount shown in the booking system. The published [2018 answer about this route](https://travel.stackexchange.com/questions/113356/can-i-buy-a-train-ticket-on-the-same-day-from-istanbul-to-ankara) confirms the earlier policy.
- **Changing an online ticket:** You must formally change the booking before using another departure, and the new train must have availability. The rules announced in October 2023 set a **75-minute deadline before departure** and a **10% deduction for changes**. TCDD’s current rules page failed to load, so confirm the conditions displayed before paying. [Report of TCDD’s rule change](https://www.aa.com.tr/tr/ekonomi/demir-yolu-yolcu-tasimaciliginda-iade-islem-ve-bilet-degisiklik-sureleri-guncellendi/3025800)

For your situation, **check Pendik → Ankara online when your departure time becomes clear, then buy immediately**. You can do that on the same day, before travelling to the station. If you decide to buy at Pendik, allow time for the ticket queue and security checks.