I recall something different than what others had suggested. When the US government issued requests for proposals, they weren't permitted to specify products by name. In particular, if you wanted something that wasn't Microsoft, you couldn't actually specify that it be Unix.
So POSIX was born partially as a way of letting it be known you wanted a Unix variant rather than something else.
Certainly porting was an issue. I did work for a software shop in the late 80s and early 90s that produced graphics software, and porting between Unix systems was relatively easy, compared to, say, moving the software to Apollo's DomainIX, a sort of Unix-like version of Apollo Domain. With Unix systems and this software, the biggest issue was fonts, as the software needed to be able to calculate the extent, that is, the bounding box, for text that was to be displayed.
Strangely enough, the other big issue was time.
Rik