Disclaimer: I am not a lawyer. If in doubt, always consult a real lawyer. "The internet told me so" does not hold in court.
As far as I know, Niantic has not officially published the game on any platform except for the official Google Play store and Apple Appstore.
Rights in App
Subject to your compliance with these Terms, Niantic grants you a limited nonexclusive, nontransferable, non-sublicensable license to download and install a copy of the App on a mobile device and to run such copy of the App solely for your own personal, noncommercial purposes. Except as expressly permitted in these Terms, you may not: (a) copy, modify, or create derivative works based on the App; (b) distribute, transfer, sublicense, lease, lend, or rent the App to any third party; (c ) reverse engineer, decompile, or disassemble the App; or (d) make the functionality of the App available to multiple users through any means. Niantic reserves all rights in and to the App not expressly granted to you under these Terms.
Effect of Termination on Trading Items, Virtual Money, and Virtual Goods
We may cancel, suspend, or terminate your Account and your access to your Trading Items, Virtual Money, Virtual Goods, the Content, or the Services, in our sole discretion and without prior notice, including if (a) your Account is inactive (i.e., not used or logged into) for one year; (b) you fail to comply with these Terms; (c ) we suspect fraud or misuse by you of Trading Items, Virtual Money, Virtual Goods, or other Content; (d) we suspect any other unlawful activity associated with your Account; or (e) we are acting to protect the Services, our systems, the App, any of our users, or the reputation of Niantic, TPC, or TPCI.
Any copy hosted outside of the Google Play store and Apple Appstore is an illegal copy, unless that copy has been explicitly approved by Niantic. In other words: The host is infringing Niantic's copyright. Downloading copyrighted material, such as Pokemon GO, from an illegal source is punishable by law in most countries. The copyright holder has the right to bring you to court for it, and demand that you pay a fine for downloading the copyrighted software. The copyright holder has the right to suspend your account for any infringement, including unlawful activity.
Usage of a legal copy of the game is not limited to countries where the game can be legally downloaded. As far as I am aware, traveling with a legal copy of the game to a country where the game is not available is allowed, and so is playing the game in that country.