If I remember correctly it was during. Michael J Fox almost got passed over for the role of Marty because of his obligation to Family Ties but he was able to work out a compromise.
I rememebr hearing him say in an interview that he got very little sleep during the filming of BttF. He would be at Family Ties during the day, then film BttF at night.. or maybe vice versa. Unfortunately I don't remember where I heard the interview..
Actually, I believe that while Michael J. Fox was Zemeckis's first choice as Marty McFly his commitments to Family Ties lead to Eric Stoltz being cast in the role initially. However, after shooting for anywhere from 2 weeks to a month with Stoltz (reports vary), Zemeckis just didn't feel he was right for the role so he reached a deal with Family Ties producers' to allow Fox to work on Back to the Future at night and on weekends. Needless to say this was very rough on Fox, as was coming into a production that had already been operating for 2 to 4 weeks and now required that everyone re-shoot work already completed to allow for a new lead actor who was there to 'save' the film.
BTW, according to the IMDB Eric Stoltz can still be seen in one scene of the film. When the Lybians shoot at Marty and he dives into the car, the person actually diving into the DeLorean IS Eric Stoltz.
Dave
p.s Apparently one of the hang-ups in getting the dvd of this film out is that while the disc producers wanted to use footage of Stoltz as Marty in the discs extras, Stoltz has no desire to have work he was fired for being seen by the public and has gone to court to fight its inclusion.