The influence of proinflammatory challenges, such as maternal immune activation (MIA) or postnatal exposure to drugs of abuse, on brain molecular pathways has been reported. On the other hand, the simultaneous effects of MIA and drugs of abuse have been less studied and sometimes offered inconsistent results. The effects of morphine exposure on a pig model of viral-elicited MIA were characterized in the prefrontal cortex of males and females using RNA-sequencing and gene network analysis. Interacting and main effects of morphine, MIA, and sex were detected in approximately 2000 genes (false discovery rate-adjusted p-value < 0.05). Among the enriched molecular categories (false discovery rate-adjusted p-value < 0.05 and −1.5 > normalized enrichment score > 1.5) were the cell adhesion molecule pathways associated with inflammation and neuronal development and the long-term depression pathway associated with synaptic strength. Gene networks that integrate gene connectivity and expression profiles displayed the impact of morphine-by-MIA interaction effects on the pathways. The cell adhesion molecules and long-term depression networks presented an antagonistic effect between morphine and MIA. The differential expression between the double-challenged group and the baseline saline-treated Controls was less extreme than the individual challenges. The previous findings advance the knowledge about the effects of prenatal MIA and postnatal morphine exposure on the prefrontal cortex pathways.