Open source software is generally legal to use for business purposes, as long as you follow the terms of the open source license that applies to the software.
Open source software is developed and distributed under a variety of licenses, each of which has its own specific terms and conditions. Some open source licenses, such as the MIT License or the BSD License, are very permissive and allow users to freely use, modify, and distribute the software without any restrictions. Other licenses, such as the GNU General Public License (GPL), place more stringent requirements on users, such as requiring them to make the source code of any modifications or derivative works available to others.
In general, as long as you follow the terms of the open source license that applies to the software, it is legal to use open source software for business purposes. This includes using the software internally in your business, as well as distributing it to customers or clients as part of a product or service that you offer.
It is important to note, however, that open source licenses do not generally provide any warranties or indemnification, so you will typically be responsible for any legal liabilities or expenses that arise from your use of the software. Therefore, it is a good idea to carefully review the terms of the open source licenses that apply to the software that you are using, and to consult with a lawyer if you have any questions or concerns about your legal obligations.