united-states The constitution, in particular the Fourth Amendment protecting against unreasonable searches and the Eighth Amendment protecting against cruel and unusual punishment, is still in force for prison inmates. That said, the courts resolved the obvious tension between an inmate's constitutional rights and the government's interest in running prisons smoothly and safely very much in favor of the government. A paper by Congress exploring this tension quotes rulings which allowed blanket cell searches without particular reason as well as routine cavity searches of incoming prisoners.
Thus, even though it is still principally in force, the Fourth Amendment in practice offers little to no protection for prison inmates. The most promising recourse against searches of inmates' residence and body is the Eight Amendment. In Bell v. Wolfish, 441 U.S. 520 (1979), an appeals court held (p. 538):
A court must
decide whether the disability is imposed for the purpose of
punishment or whether it is but an incident of some other
legitimate governmental purpose. They cannot be used to inflict additional, unusual or cruel punishment.
Presumably, an example for a violation of the Eighth Amendment would be frequent cell and body searches which were conducted not in order to keep the prison running but in order to keep an inmate from sleeping, only because the prison personnel hate them or think the sentence is too lenient.
germany For comparison: The constitution in Germany takes a very different approach to government. In the aftermath of Fascism, human and personal rights (the famous "inviolable dignity") were made the foundation and commitment of all government authority. Consequently, the Constitutional Court found that routine cavity searches without specific reason violate the constitutionally protected rights of the prisoner. While it is a bit embarrassing that it needed the Constitutional Court to stop the Bavarian (the German equivalent to Texas, if you want) administration and lower courts in their authoritarian ways, it is also a reminder of the wisdom and foresight of the "parents" of the West German post-war constitution which continues to structure and restrain government work.