There are many open source license type. Some allow to reuse in a commercial software, other don't. All will allow you to amend the code for your own need as long as you respect the other clauses of the licence.
Specifically for QGIS, the licence is the GNU General public Licence. It is a copyleft license, which means that derivative work can only be distributed under the same license terms. In other word, you cannot redistribute QGIS code under a proprietary licence, but you can make commercial use of the QGIS software. For sales or distribution, the entire source code need to be made available to end users, including any code changes and additions—in that case, copyleft is applied to ensure that end users retain the freedoms defined above
So, for example, you are allowed to sell a software based on QGIS with your own add on if it remains under the GPL licence. As it is under GPL, your software will be under GPL and your client can redistribute it under GPL if he wants. So if you want many clients you'd better offer some services around your distribution of the software.
EDIT: to give another example, GDAL is under the X11/MIT licence, which means that it is intended to give you permission to do whatever you want with the GDAL source code: download, modify, redistribute as you please, including building proprietary commercial software, no permission from anyone else is required. Most proprietary commercial GIS software use gdal.