You'll get generally get more bass reinforcement close to the wall with rear ports as you will with any speaker. You generally would not want to go flush or even very close against the wall and obstruct the air motion through the port. That would limit the bass levels. Not to say that might not be desirable and sound better even in some cases. Generally, it is just not a good idea to fully obstruct the air motion through the port.
The main downside of placement too close to wall in all cases is early reflections from the wall that smear the soundstage. Its more an issue at higher frequencies though and not really an issue at the lowest frequencies handled by ports though. Some speakers might be designed to be placed close to the front wall and still control or avoid early reflections. A lot of speakers designed for "bookshelf" or near wall placement are this way. Nowadays, many small speakers are designed to go on stands aways from walls rather than close to walls or on bookshelves. It was much more common in years past.
The main downside of placement too close to wall in all cases is early reflections from the wall that smear the soundstage. Its more an issue at higher frequencies though and not really an issue at the lowest frequencies handled by ports though. Some speakers might be designed to be placed close to the front wall and still control or avoid early reflections. A lot of speakers designed for "bookshelf" or near wall placement are this way. Nowadays, many small speakers are designed to go on stands aways from walls rather than close to walls or on bookshelves. It was much more common in years past.