Scripturally we can see some reasons why the Lord will occasionally show signs to the wicked:
To vindicate prophets. The sign that Nephi, son of Helaman, gave to the people concerning the death of the chief judge showed that Nephi was right (see Mosiah 20:21).
Leave the wicked without excuse. The wicked are completely responsible for their actions thereafter. The Lord has stated, “He that seeketh signs shall see signs, but not unto salvation” (D&C 63:7).
Show correctness of prophets’ words. Since the wicked seek to prove the prophet wrong, the Lord will occasionally show indisputable signs (see Helaman 9:2–4).
Condemn the wicked. When the wicked see signs, it is through the Lord’s anger and to their condemnation (see D&C 63:11). The Savior stated, “An evil and adulterous generation seeketh after a sign” (Matthew 12:39).