The main problem with rear ported speakers being close to a wall is that the port, like the cone, is a radiator and the strong reflected sound interferes with the directly radiated sound.
If the speakers must be close to and perpendicular to the walls, then you will want to scatter (diffuse) the sound from the wall. The heavy drapes will certainly help with absorption of some frequencies, but look into getting some wall treatments to go immediately behind the speakers. The drapes give you the advantage of not being concerned with the aesthetics of the treatments if you want to absorb and diffuse. Details and recommendations can be found in other threads, including cost-effective D.I.Y. options.
would it benefit even more to plug the ports with foam?
This will change the dynamics of the speaker, but is effective in reducing the sound radiated from the port. With proper EQing, which you would do anyway, this may be a viable option.
You don't mention details of your space, what you will use to drive the speakers or your listening preferences, so this all assumes that you'll have plenty of good clean power for the space.