Allowing Unknown Sources on a Firestick or Android device is 100% legal. However, while sideloading third-party apps is not illegal in any way, streaming some of the content within these may be.