No, that won't be a problem.

You don't need to be a permanent resident or on a current visa to get a marriage license. Check the local requirements for identification where you intend to get married; it varies from county to county.

A word about the I-864.

You MUST understand what this form actually means.

It means that you - and/or whoever sponsors him - may be on the hook to provide him with financial support indefinitely should you ever get divorced.

You are promising the US government that he will never become a public charge (ie, go on State aid).