The requested Profile (gid = 9 ) is disabled OR not set to be used
On the Contribution Page setup, below the checkbox to enable 'on behalf of' there is help text explaining that it uses the "On Behalf Of Organization" profile - unless you change it.  You are seeing an error relating to profiles when you enable the section that says it uses a profile, so that is a good clue as to the cause of the problem.

Let's step through the various causes suggested in the error message:

1) Is Profile (gid=9) disabled?

Go to Administer &gt; Custom Data and Screens &gt; Profiles  Click the Reserved Profiles tab.  Id 9 is 'On Behalf of Organization' in a default config (4.7) which corresponds with the help text.
 It is a reserved profile, so you don't have the option to disable it.  This is not the cause of the problem.

2) Is Profile (gid=9) set to be used as 'overviews'?

This is not obvious as there is no setting described as 'overviews'.  But since this is core behaviour and you can't change it, let's assume that is correct for now.

3) Does Profile (gid=9) exist?

Yes - we have just seen it in the listing. (Arguably this should be the first cause listed!)

4) Do you have access to the Profile?

This is the last of the suggested causes and also corresponds to the behaviour you are seeing that the problem depends on whether or not you are logged in.

Now we need to check permissions.  You don't mention which CMS you are using, but I'll use Drupal here.

Go to the Drupal People &gt; Permissions page. In the CiviCRM section, look for settings relating to 'profiles' and see what permissions your anonymous users have.  It is not always obvious which permissions are relevant but we are using the profile to enter new data rather than view data so 'profile create' looks likely.

Is 'CiviCRM: profile create' enabled for anonymous users?  Probably not.  Enable it, save and try to view the contribution page again when not logged in.

Warning: Be wary of granting new permissions if you don't understand what they mean, particularly for anonymous users as you can inadvertently expose far more data than intended.  You can find confirmation that 'profile create' is appropriate in the documentation.