Either the sender or the recipient can share their text messages with anyone. Consent of both parties is not needed nor is a court order. Once a text is sent there is no expectation of privacy.
The response given is not intended to create, nor does it create an ongoing duty to respond to questions. The response does not form an attorney-client relationship, nor is it intended to be anything other than the educated opinion of the author. It should not be relied upon as legal advice. The response given is based upon the limited facts provided by the person asking the question. To the extent additional or different facts exist, the response might possibly change.
If you are referring to text messages between two other individuals (let's call them A and B), and you are involved in litigation related to either A or B, the most straightforward way to obtain the messages would be to issue a discovery request for the person who sent/received the messages to produce copies. (Discovery is a common phase in litigation in which the litigants are required to turn over information to the other side in advance of trial.)
If you're contemplating asking the service provider (Verizon, etc.) to turn over text message records, you should be aware that this type of communication is covered by a strict federal privacy law, the Electronic Communications Privacy Act (ECPA), which generally does require a court order or search warrant before the wireless operator will agree to turn over the records. See link below for more information.