Actually, there are a lot of "it depends" in any answer I can provide, and trademark law is far too complex to discuss in much depth in a forum post. If your hypothetical example reflects your real business concerns, you would be wise to sit down with an IP attorney in Canada for advice tailored specifically to your needs. All of law relies on the particular facts presented in a situation.
That said, and most basically, trademark rights are established in any country based on that country's trademark laws. These laws vary from country to country, often in significant ways. There is no one-size-fits-all international trademark law.
There is, however, the Madrid Protocol, an international treaty that allows, for example, a U.S. trademark owner to file a single application for registration of their trademark with the United States Patent and Trademark Office (USPTO) and with member countries at the same time. Your Canadian "ABC" trademark rights, then, could potentially depend on what rights, if any, the U.S. "ABC" has established through commerce in Canada and through the registration of their mark with the Canadian Intellectual Property Office.
If the U.S. ABC has not registered their trademark in Canada or has not conducted business in Canada under the ABC name, and if you have not registered your ABC trademark with the USPTO in the U.S. or conducted business in the U.S. under the ABC name, both ABC trademarks would generally be able to peacefully coexist, as long as the ABCs remain in their home countries.
This peaceful coexistence, however, precludes you using your trademark on your products or services in the U.S. and precludes the U.S. company from using their trademark on their products or services in Canada. For either of the ABC's to do business in their neighboring country, they would have to do it under another name, so as to not infringe on the trademark rights already established by the other company in the other company's home country. In other words, the U.S. ABC could market their products or services in Canada under the new name DEF, but not under their U.S. name of ABC. And this is all assuming the products and services are similar enough that the use of the same names would cause consumer confusion. The two Apples are able to use the same name because their products and market are different.
As a note, in the U.S., trademark registration is not a requirement to determine ownership of a mark. The mark is (generally) owned by the first to use the trademark in commerce. I believe this is true in Canada, as well, although this is not the case in all countries. In some countries, ownership depends on registration - so if a company were to use an unregistered mark in commerce for 10 years, but some other company comes along and registers the same mark, it is the company that has the registered mark that owns the trademark.
I hope I have covered this sufficiently.