Switches can dynamically detect the speed using Fast Link Pulses (FLP).
Switches detect duplex by only negotiation. If one side is not configured for autonegotiation, the other side will use the default setting.
Defaults:
10Mbps Half Duplex
100Mbps Half Duplex
1Gbos Full Duplex
Switch A Switch B
10Mbps Full Duplex 10Mbps/Auto = 10Mbps/Half Duplex
100Mbps Full Duplex Auto/Auto = 100Mbps/Half Duplex
1Gbps/Auto 1Gbps/Auto = 1Gbps/Full Duplex