Yes they can fast and plenty of pilots are doing it. What is more disturbing some pilots are no even drinking water during the daylight hours of Ramadan.
This is the very reason I will not strap myself to the seat of an A/C operated by an Islamic state, during Ramadan.