If the type of other_table and other_table2 where the same, then the easiest way to do this would be:
IQueryable<SomeType> joinTable = condition1 ? other_table : other_table2;
And then use join j in joinTable as part of your query.
Otherwise, if you are only using the join to restrict a where condition, rather than to affect the fields, you could first write query to ignore that and then add something like:
if(condition1) query = query.Where(q => other_table.Where(o => foo==bar).Select(o => o.DriverId).Contains(q.DriverId)); else query = query.Where(q => other_table.Select(o => o.DriverId).Contains(q.DriverId));
Here the restriction of foo==bar is to show that we can add quite a bit of detail to these further Where clauses if necessary. The main thing is that Where doesn't change the type of the result; query is IQueryable<T> for some T, and remains so after the Where so we can assign that query back to query.
If the join is to add values then:
var newQuery = condition1 ? query.Join(other_table, q=>DriverId, ot => ot.DriverId, (q, ot) => new {q.DriverID, q.TripId, ot.OtherField} : query.Join(other_table2, q=>DriverId, ot => ot.DriverId, (q, ot) => new {q.DriverId, q.TripId, OtherField = ot.YetAnotherField};
Note that other_table.OtherField and ot.YetAnotherField must be of the same type. This depends on the compiler creating any anonymous classes with the same name, order and type of fields as the same class, so newQuery's type can be deduced (and is the same for each branch). If they are not the same type then you need to either cast one to the type of the other, or else do something like:
var newQuery = condition1 ? query.Join(other_table, q=>DriverId, ot => ot.DriverId, (q, ot) => new {q.DriverID, q.TripId, ot.OtherField, YetAnotherField = (string)null} : query.Join(other_table2, q=>DriverId, ot => ot.DriverId, (q, ot) => new {q.DriverId, q.TripId, OtherField = -1, ot.YetAnotherField};
In this last example, OtherField is an integer which is set to -1 if condition1 was true, while YetAnotherField is a string which is set to null if condition1 was false.