Playing casinos online is perfectly legal in many countries, especially in Europe and Asia. Regulatory bodies such as the UK Gambling Commission and the Malta Gaming Authority overlook gambling activity in those countries. Similar examples can be seen in Gibraltar, Sweden, Denmark, and Spain, for example. A growing number of countries are legalizing online gambling.
On the other hand, in North America, just a handful of the States accept casinos online. The states where online gambling is legal are Delaware, Nevada, New Jersey, Pennsylvania, and West Virginia. However, more states are likely to legalize gambling online in the near future.
Generally speaking, gambling is legal only if the law of that country permits it. Be responsible and make sure to research gambling laws and regulations in your country before registration.