Yes they can, but don’t let this panic you! There aren’t long lines of people being turned away from their flights to Bangkok. It isn’t common for airlines to prevent passengers from boarding, but they do have the authority to do so if the passenger doesn’t meet the Thai immigration requirements. The advice is straight-forward; make sure you have a valid visa if you don’t qualify for the visa exemption rule.
Much depends on the individual airline and different carriers have different policies, but if your airline realizes that you don’t meet Thai visa requirements they have the authority to prevent you from boarding. In fact, most of the potential problems occur at the point of departure rather than at Thai immigration.
Prior to October 2006 there was a lax attitude towards Thai visa requirements on the part of airlines and the Thai authorities. Since October 2006, already existing regulations have been more strictly enforced. This has had the effect of airlines paying much closer attention to ensure that passengers meet Thai visa requirements. An airline could be at fault if a passenger is refused entry in Thailand for not having the correct visa. The airline could then be responsible for the cost of flying that passenger straight back home. It doesn’t matter that an airline has sold you a flight ticket; it is up to you, the passenger, to ensure you meet the Thai visa regulations. Please refer to the relevant parts of the visa section to find out if you require a visa before travel or if you qualify for the visa exemption rule. If in any doubt, contact your nearest Thai embassy or consulate in your home country.
Please also pay attention if you have a one-way ticket to Thailand. Some airlines may still refuse boarding even if you have the correct visa stamp in your passport. This has nothing to do with Thai immigration, but everything to do with individual airline policy. If you are considering flying on a one-way ticket to Thailand, I would strongly advise obtaining written confirmation from your airline before purchasing the ticket, that you will be allowed to board if you have the correct visa.