There's no such minimum. Your employer can apply for an immigrant worker even if that worker hasn't spent a day in the US.
There's no maximum either, but there's a maximum limit on your stay in the US on H1b status. If you reach that limit without applying for permanent residency - you'll have to leave the US for at least a year. If you're in the process already - your H1b can be extended, despite that limit, until your AOS process is complete. There are certain conditions under which such an extension can be granted, and one of them is how long you've been in the employment-based green card process already. It is best to start your green card process at least a year before the 6-year H1b limitation expires.