Yes they can! There is even a medical term for this, called “pyroflatulence”.
Farts (flatulence) are made up of a variety of gases, including carbon dioxide, hydrogen sulfide (which is responsible for the smell), methane, and nitrogen.
There have been cases of farts ignited in the operating room, causing injury to patients and even one patient death. It was believed that instruments used during surgery, such as cautery units, ignited the farts.
The interested reader should be directed to the many youtube videos that demonstrate this phenomenon.