In less touristic places, relatively modest dress is recommended.
Women should avoid very tight clothing, keep their shoulders and knees covered, and avoid very revealing necklines. Men should also avoid particularly revealing clothing.
wearing shorts is not very common among Egyptians. Dressing with relative modesty is a way of respecting the local culture.
The metro in Cairo has separate cars for women that might be more comfortable, especially during rush hours when the cars can be very full.