You should see this similar SO question. I am not sure if you can do this at runtime, but I've found this to be possible after deployment. Beware, there are definitely pitfalls.
The main differences between EDMX files that are generated between different database backends are the MSL and the SSDL. What I've done is generated the EDMX file separately from each database. They both have the same logical data model (CSDL). I then extract the MSL and SSDL file and save it into separate files. Once that is done, you can specify in your connection string the exact location of these files (as shown):
<add name="DBConnection" connectionString="metadata=C:\sqlServerEntities.csdl|C:\sqlServerEntities.ssdl|C:\sqlServerEntities.msl;provider=System.Data.SqlClient;provider connection string="Data Source=[machinename];Initial Catalog=[databasename];Persist Security Info=True;User ID=[user];Password=[password];MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
<add name="DBConnection" connectionString="metadata=C:\mdbEntities.csdl|C:\mdbEntities.ssdl|C:\mdbEntities.msl;provider=[mdb provider namespace];provider connection string=[DB connection string]" providerName="System.Data.EntityClient" />
You'd have to use the appropriate connection string at runtime based on which database you're connecting to. I am concerned that you might have difficulty using STPs in one scenario and table-based mapping in the other though.
One other note: you cannot leave both the EDMX models in your project or you will create compiler errors (based on duplicate class definitions). However, you have to leave one in your project so the compiler knows about the logical classes that were generated.