I just contacted the MathWorks Support regarding this issue and I solved the problem by following their tips.
The solution was to include every file in the "MQTT in Matlab" toolbox (see the screenshot below) in the Matlab Compiler.
The compiler may show a warning sign during packaging but the compiled program works just fine.
I hope if someone has the same problem will find it helpful.