Depends. There are two different notions, lawful status and lawful presence. One may lose his status, but remain in the period of lawful presence. A simple example is when someone applies for a change of status or when someone applies for asylum. During the pendency of the case, the applicant does not have a status but is lawfully present. If the change of status is denied, the unlawful presence begins to count. Why is it important to differentiate lawful status from lawful presence? – Because the applicability of 3 and 10 year bans under INA 212(a)(9)(B) and (C) depends on the length of unlawful presence, not unlawful status.
Under INA 212(a)(9)(B), also known as 3-year ban, a person who spends more than 180 days but less than 365 while unlawfully present, will be banned from returning into the United States for the next 3 years, after she leaves the United States. But if the person accumulates more than 365 days of unlawful presence (i.e. spends more than one year in the US while unlawfully present), then he or she will be banned from returning into the US for the next 10 years. This includes even immigrant visa process (green-card process) through marriage to a US citizen. The ban becomes effective when the unlawfully present person leaves the US.
For example, if someone who entered the US on a tourist visa, applied for asylum and then got selected for DV-lottery (i.e. won green-card in a lottery) during the asylum process, she may be able to obtain her green-card through a US consulate abroad. Whether she will be banned from returning will depend on the number of days spent in the US in unlawful presence. B-2 visitor is usually granted 6 months of lawful status, which in this case also means 6 months of lawful presence. If she applied for asylum before her B-2 visitor status expired and did not work without authorization while her asylum application was pending, then she did not begin to accrue any unlawful presence for the purposes of 3-year or 10-year ban. As such, she may be able to obtain her green-card through a US consulate. She cannot adjuster her status in the US, despite having a pending asylum case, because she does not have a lawful status. But she can leave the US and get her green-card through a US consulate abroad. Doing so will require many calculations and preparations, including possibly having to withdraw asylum application or, in the best-case scenario, obtaining an advance parole, so as not to lose her pending asylum case.
In the case of B-1, B-2, H-1B, and many other visas, the alien begins accruing unlawful presence when they overstay the expiration date indicated in their I-94 arrival-departure document. The same date is also written by the CBP officer on the entry stamp in the alien’s passport, when she enters the US using one of those visas. This is the date by which the alien must leave the US or extend/change/adjust her status. However, in the case of F-1 and J-1 visas, the I-94 and the stamp in the passport do not contain a definite deadline by which the alien must leave the US. In such cases, the stamp shows “D/S”, which means duration of status. According to the USCIS’s policy, such individuals who have “D/S” instead of a definitive date in their I-94s, do not begin to accrue unlawful presence unless and until one of the following occurs: (a) she applied for change of status, which got denied; (b) she successfully changed her status to another status (e.g. J-1 to B-2), which had a definitive deadline to depart now expired; (c) the immigration judge ordered her removal. In all other circumstances, she continues to remain lawfully present in the US despite her previous status violations or overstay of her F-1 or J-1 visa.
As such, an individual who overstays an F-1 or J-1 status, does not automatically begin to accrue unlawful presence for the purposes of 3-year or 10-year ban under INA 212(a)(9)(B) and (C).
 Note that in the case of pending asylum, if the applicant works before obtaining the work permit, the applicant begins accruing unlawful presence.
 INA 212(a)(9)(C)
 The ban applies to all forms of immigration, including non-immigrant and immigrant visas and marriage-based green-card process through US consulates.
 Except in the case of an advance parole. See Matter of Arrabally, 25 I&N Dec. 771 (BIA 2012).