The context is Covenantal. The "witness" here is a legal witness against the Covenant people, as it is in the Old Testament, ending with John the Baptist. The witness here is that of the apostolic church.
A minimum of two witnesses is required to make a legal judgment and carry out an execution of the law. This is why there were two angels at the Garden gate in Genesis 3, and two cherubim flanking the Law (the Ark) in the Most Holy.
The apostolic church was continuing the witness of Moses and Elijah (law and prophets) given to the disciples in the words of the Father. They were to hear the testimony of His beloved son, which united and superseded those witnesses. Hence, the two witnesses are presented as having the powers of Moses and Elijah.
Horns are not witnesses, but kingly authority to execute judgment. Instead of a witness of God's mercy (as a lamb like Abel), the judgment here is Cainite: kingdom usurping priesthood, exaltation before humility. The dragon desires to devour the "fruit" of the woman.
One beast comes from the abyss (the Gentile "Sea") and the other from the earth (more correctly, the "Land" of Israel). The Land Beast is supposed to be a sacrificial lamb, but its kingly power has not come from humility before God but from "intermarriage" (a false Covenant) with the Gentiles (Rome). The two horns might be the collusion of the High Priesthood and the Herodian dynasty.
We have seen a lamb with horns already in Revelation 5. He combines the three furnitures in the Holy Place: Lamb (table of showbread: Priest) with seven eyes (lampstand: King) and seven horns (incense altar: Prophetic elder). With true authority, through the witness of the saints, He sets the Gentiles onto the Herods, and the "Land" is again engulfed by the "Sea," as it was in the days of Noah, where the world was corrupted through godless intermarriage.
Whenever you see "earth" in the Revelation, substitute "Land." The book makes much more sense.