If you are a woman, make sure to cover your knees and shoulders when you are out and about. Avoid cleavage. If you’re going to enter a religious compound or mosque, you must cover your hair.
Inside resorts and hotels that cater to foreigners, you can typically dress exactly as you would in any Western country.
Men should bring long pants and conservative shirts to wear out and about. If you must wear shorts, have them cover the knees.
When swimming on public beaches that are not associated with a resort or hotel, check the bathing regulations closely. You can often swim so long as you are well-covered, which includes Western rarities such as men wearing tops.