A contract is any agreement made between two or more people by voluntary, mutual consent. Therefore, contract doesn't violate the non-aggression principle. A synonym for contract is the phrase voluntary exchange.
In discussion, the term contract is often understood this way, however, from a libertarian perspective, it contains some qualifiers. Adhering to the non-aggression principle, for example, is one of these qualifiers.
For some libertarians, however, it may better be described in terms of not violating rights. The term of right, however, is something still debated among many - especially amongst Mutualists, Geoists, utilitarian Anarchists, and natural rights theory Anarchists.