Answer: Jesus did indeed preach to spirits in prison but not during the period between his death and resurrection. The scriptures concerning your question about restrained spirits can be found toward the end of 1Peter.
By which He also went and preached to the spirits in prison, which disobeyed in a past time, when once the long-suffering of God was waiting in the days of Noah, while the ark was being prepared . . . (1Peter 3:18 - 20, HBFV throughout).
Christ's last words on the cross were "Father, into your hands I commit My spirit" (Luke 23:46). He was then dead and completely unconscious for the three full days or 72 hours. God gave him back his spiritual essence when he resurrected him from the dead. This means it was impossible for Christ to communicate with anyone for the entire time between his death and resurrection.
Who are they?
Let us now tackle a couple of basic questions generated by 1Peter 3:19 before answering your inquiry. Who were these disobedient spirits (verse 20) and why were they in a prison? These beings were not conscious "immortal souls" of evil humans who had died, since at death all humans become unconscious and remain so until the resurrection. We find our answers in the books of 2Peter and Jude.
For if God did not spare the angels who sinned, but, having cast them into Tartarus (Strong's Concordance #G5020, meaning a place of restraint), delivered them into chains of darkness to be kept for the judgment . . . (2Peter 2:4).
And the angels who did not keep their own original domain, but deserted their habitation, He is holding in eternal bonds under darkness unto the judgment of the great day (Jude 6).
When Satan rebelled against God (Isaiah 14:12 - 15, Ezekiel 28:12 - 18) he convinced a third of all the angels to become evil spirits and follow him (Revelation 12:4). After Lucifer's rebellion was totally crushed, God decided to place a certain number of disobedient angels into some kind of spiritual prison (we do not know how many) to await judgment.
The devil, the chief of the demon spirits, will be thrown into such a prison at Christ’s return (Revelation 20:1 - 3). He will spend about 1,000 years in it then be released (for a short time) at the end of the Millennium (verse 7).
When did they hear it?
When did Jesus preach to these evil spirits in prison (a place of restraint)? We find our answer in 1Peter 3 that states, "Which disobeyed in a past time, when once the long-suffering of God was waiting in the days of Noah, while the ark was being prepared . . ." (1Peter 3:20, HBFV).
The Lord personally witnessed to these spirits at a time when humans, who had existed on the planet for more than 1,500 years, had reached a point where they thought about doing evil all the time (see Genesis 6).