No one knows how the courts will eventually rule on this law, or on the somewhat similar Florida law now being litigated.
It is true, as the answer by Trish says, that the government cannot compel a publisher to publish things against its wishes, and that an individual cannot generally be compelled to make statements of political views. In West Virginia State Board of Education v. Barnette, 319 U.S. 624 (1943) the US Supreme Court wrote:
If there is any fixed star in our constitutional constellation, it is that no official, high or petty, can prescribe what shall be orthodox in politics, nationalism, religion, or other matters of opinion or force citizens to confess by word or act their faith therein.
However Section 230(c)(1) of the Communications Decency Act says that:
No provider or user of an interactive computer service shall be treated as the publisher or speaker of any information provided by another information content provider.
Thus requiring that a person be allowed to have an account is not requiring the owner of the service to publish anything, since the owner is not the publisher of any user's content, nor does it require the owner or anyone else to make any statement, and in particular not to make any statement specified by the government.
It is constitutional, in general, for a state to pass anti-discrimination laws, or laws requiring that a business give access to particular groups of people. If a social media platform is treated as a service allowing people to publish their own views, then the state may pass laws limiting the exclusion of people from that service on particular grounds.
That does not prove that the law is constitutional, but it shifts the ground of inquiry significantly. The exact provisions of the Texas and Florida laws may be significant in the eventual decision.
I doubt that Knight Institute. will be found relevant. That case was based on the very unusual situation that a public official, and in particular the president of the United States, was using social media as a means for distributing official policy statements, and as a public forum for comments on them, and it was held that Trump could not, in those circumstances, exclude specific individuals, as that would constitute government action against those people. That situation is quite different from the ones under the Texas and Florida social media laws.