On 50 Years of Star Trek (according to Yahoo Movies), Nicholas Meyer explained that a draft of Star Trek IV: The Voyage Home was penned with Eddie Murphy’s inclusion in mind.
One look at Rotten Tomatoes will tell you that Star Trek IV: The Voyage Home currently holds a Certified Fresh rating at 85%, so the film obviously didn’t need Eddie Murphy to achieve critical acclaim.
Paramount didn’t like the idea of putting all their golden eggs in one basket, Eddie Murphy and the Star Trek people.
They had had a script written tailor-made to star Eddie Murphy, who was Paramount’s other big star at the time.