Both female and male crabs may be taken recreationally as long as they meet the minimum size requirements. Only the commercial Dungeness crab fishery restricts harvesting to male crabs.
If you are wondering why some crabbers may toss females back its because female crabs are often so much smaller and less meaty than the males, so many crabbers toss them back so they can reproduce more young for future generations. Also, the larger females that meet the minimum size requirements carry the most eggs and produce the most young, so it makes sense to let females go as a matter of course. However, there is no law that compels you to do so.