A pact is a treaty or other agreement between parties, and it's usually written. Countries can have pacts or you can make a pact with your friends, promising each other that you'll all show up for the spelling bee.
A pact is a formal agreement. The 1955 Warsaw Pact, for instance, was Eastern Europe's answer to NATO (the North Atlantic Treaty Organization), with communist countries pledging mutual aid in case of foreign aggression. You may also come across the word compact, which is pretty much the same as a pact. The word pact comes from the Latin pactum, meaning "something agreed upon." In Roman times, one kind of pact was the marriage pact you signed when you got married.