Because you tagged this question with both "business" and "employment," I'm assuming that the profit-sharing contract you are asking about is a contract with an employee of the nonprofit organization. If so, you are dealing with a question involving a topic that nonprofit attorneys call "private inurement." In general, a nonprofit organization cannot be operated for the private financial benefit of any of the insiders who run the organization. In general, the compensation paid to the employees who run the organization must be reasonable. Paying excess compensation to an employee (which might occur if the nonprofit commits to paying a percentage of the retained earnings) can cause what the IRS will call an "excess benefit transaction" to a "disqualified person." The person who received that excess benefit will have to repay it (with interest) and pay an excise tax. In some cases the management of the organization can be on the hook for excise taxes as well. The IRS calls that "intermediate sanctions." In extreme cases, the IRS can revoke the tax exempt status of the organization.
So, why did I say "it depends"? There once was a 501(c)(3) hospital that negotiated a profit-sharing agreement with a radiologist. The hospital asked the IRS to tell it whether the agreement would violate the private inurement doctrine, and the IRS found, in Revenue Ruling 69-383, that it would not. The IRS's reasoning was that "the radiologist did not control the organization and the agreement was negotiated at arm's length. The amount the radiologist received was reasonable in terms of the responsibilities and activities that he assumed under the contract." That made this radiologist different from cases where doctors' profit-sharing plans had "transform[ed] the principal activity of the organization into a joint venture between it and a group of physicians" or was "merely a device for distributing profits to persons in control."
A nonprofit organization attorney can tell you more, and can give you advice based on the specific facts of your case (which this is not.)