(covers information from several alternate timelines)
A black hole is an incredibly dense remnant of a star that has collapsed into a singularity under its own gravity upon running out of fuel. Black holes have extremely strong gravitational fields, similar to cosmic string fragments, so powerful that not even light can escape.
The late-20th century NASA probe Voyager 6 disappeared into a spatial anomaly that at the time was believed to be a black hole, emerging on the other side of the galaxy, where it came into the possession of a race of sentient machines. The machine race constructed a massive vessel around the probe, V'ger, to facilitate its mission of acquiring all knowledge, and it began its journey back to Earth. (Star Trek: The Motion Picture)
In 2152, Enterprise NX-01 encountered a black hole that was part of a trinary system, something unheard of by either Starfleet or Vulcan scientists. Attempting to study the black hole, the Enterprise crew became affected by an exotic form of radiation which caused nearly all members of the crew to exhibit irrational and obsessive behavior. Sub-Commander T'Pol, whose Vulcan physiology was immune to the radiation, performed an analysis which indicated that prolonged exposure to the radiation would be fatal to the crew, forcing her and Captain Archer to navigate Enterprise through a hazardous debris field in order to escape the influence of the radiation in time. (ENT: "Singularity")
In 2257, the Talosians created an illusory black hole around their homeworld, Talos IV, to test the resolve of Michael Burnham and Spock as they approached the planet. Spock piloted their shuttle directly into the event horizon, breaking the illusion and revealing Talos behind it. (DIS: "If Memory Serves")
In 2366, the USS Enterprise-D engaged in an operation to stabilize the moon of Bre'el IV, which was in danger of crashing into the planet. The crew was informed by Q that the deterioration of the moon's orbit was most likely caused by a black hole passing through the star system's plane at near-right angles. (TNG: "Deja Q")
In 2369, the crew of the Enterprise-D encountered a race of aliens from another time continuum who utilized the gravity wells of black holes as nests for their young. The aliens had mistaken a Romulan vessel's artificial quantum singularity, which the Romulans used as a power source, for a natural black hole, and their young became trapped. When the Enterprise generated a power transfer beam to send energy to the Romulan ship, it resulted in the creation of a temporal aperture, which disrupted spacetime around the ships and created a series of temporal fragments. With the help of the Enterprise crew, the embryonic lifeforms were eventually freed. (TNG: "Timescape")
In 2374, USS Voyager discovered a communications relay network which was a hundred thousand years old and was being used by the Hirogen in the Delta Quadrant. Analysis indicated that each of the relay stations utilized a harvested microsingularity as a power source. While engaged in battle with a Hirogen vessel, the Voyager crew used an antithoron burst to destabilize the containment field around the singularity and increase its gravitational pull. The plan worked, but the containment field failed, destroying the relay station and causing the singularity to grow into a black hole. While Voyager was able to escape, the Hirogen ship was destroyed. (VOY: "Hunters")
Black holes can be artificially created through the ignition of a small amount of red matter. In 2387, Ambassador Spock created such a black hole in order to absorb the energy of a supernova, formerly the Romulan sun, which threatened the entire galaxy. Spock's plan succeeded, but he was too late to save Romulus, which was destroyed by the exploding star. The resulting black hole created a tunnel through spacetime, into which both Spock's ship, the Jellyfish, and the Romulan mining vessel Narada were pulled, depositing the Narada in the year 2233, resulting in the creation of the alternate reality.
Spock, who entered the black hole a few seconds after the Narada, emerged twenty-five years later due to the time differential, and was captured by Nero, the Narada's captain. Nero, who held the Federation responsible for the destruction of his homeworld, stole the red matter from Spock's ship and used it to create a black hole at the center of Vulcan, destroying the planet. Nero attempted to perform the same action on Earth as he did to Vulcan, but was stopped when Spock's alternate-reality counterpart piloted the ship containing the red matter to a collision with the Narada. This caused the red matter to ignite and create a black hole within the Narada itself, destroying the ship. (Star Trek; PIC: "Remembrance")
At some point circa 2380, the USS Cerritos nearly fell into a black hole in a binary star system after sustaining damage from a meteor impact, but managed to escape. (Star Trek: Lower Decks opening credits)
This type of anomaly was referred to in the scripted description of a scene from Star Trek VI: The Undiscovered Country wherein General Chang's Bird-of-Prey is located by the USS Enterprise-A using a photon torpedo, disrupting the Klingon Bird-of-Prey's cloaking device and making the ship visible. The film's script lightheartedly referred to the point at which the craft became trapped as "the 'black hole'".
The Talosian illusory black hole marked the first time that the then latest, most recent, scientific visual interpretation of the phenomenon is seen in Star Trek. The visual interpretation is based on the work of theoretical physicist and Nobel Prize laureate Kip Thorne and his collegues. Thorne closely cooperated with the digital modelers of CGI company Double Negative (DNeg) to create a scientifically accurate representation of a black hole, which was for the first time featured in the acclaimed 2014 science fiction film Interstellar.   DNeg incidentally, went on to (co-)provide the digital visual effects for Star Trek Beyond,  Star Trek: Short Treks,  and Star Trek: Picard.  It is also known that DNeg has contributed CGI to the second season of Discovery, albeit uncredited,  and it is tempting to assume that it was their Interstellar black hole model that stood in for the Talosian black hole, though firm confirmation of this has yet to be forthcoming.