I access two different gmail accounts using IMAP in Mail. I organize those accounts into folders on my Mac (both gmail accounts go into the same folders). As soon as I put an email into a folder, I can no longer access it on my iPhone. Is there anyway to sync my folders with my iPhone as well?
The problem you are having is because the folders are on your Mac rather than in one of your Google accounts.
If you want to be able to read the emails on your iPhone they will have to be on the Google IMAP server.
Can I suggest you get one of the two Google accounts to forward its email to the other account. Then you could put the folders in that account and they would be on the Google servers and accessible from anywhere you want.
You can even set it up so that you can choose which of the two accounts is sending any email you send, even from the one account.
You don't have to have them all in IMAP when you create the sub folders and sort emails into them.
Instead of creating those sub folders under "ON MY MAC", you can create them under "ICLOUD". As long as your computers and devices are iCloud enabled, they all share the folders in ICLOUD.
Just bring mouse over ICLOUD and you will see "Show" shows up on the right. Click on "Show". You may see only the "Draft" folder initially. Ctrl-left click, mouse-right click or Mailbox menu will show "New Mailbox" option.
The folders created in ICLOUD will be shared between all ICLOUSE devices.
You can also MOVE the old folders into ICLOUD (the local folders will be deleted) or COPY mails into new Folders created under ICLOUD.
If you are moving or copying into ICLOUD and have got a lot of mails and many/large attachments, this may take a long time and need a lot of data bandwidth. Do it, only if and when you can.