The line quoted above is said by Theseus in Act V, scene i as he, Hippolyta, and the four lovers watch the play performed by the Rude Mechanicals. The performance is so comically awful that the characters watching it can't help heckling the actors and making snide remarks among themselves. Think of it like Elizabethan Mystery Science Theater 3000.
HIPPOLYTA: This is the silliest stuff that ever I heard.
THESEUS: The best in this kind are but shadows; and the worst
are no worse, if imagination amend them.
HIPPOLYTA: It must be your imagination then, and not theirs.
Here we see Theseus defend the players from Hippolyta's critique of the play as "silly," by saying that even the very best plays ("the best in this kind") are nothing more than "shadows," or pale imitations of real life. By Theseus's logic, the "worst" examples of theater, as Pyramus and Thisbe undoubtedly is, can make for just as good an illusion/imitation/shadow with a little added help from the imagination of the audience ("if imagination amend them.") In short, if all theater is mere illusion to begin with, than the worst plays can be just as good as the best if the audience fills in the cracks with their imagination.