What are units actually? This question is about the concept of units in physics.
Firstly - do units have a formal mathematical definition? How are they different from pure numbers? Are pure numbers defined to be ratios of unit sizes? Were the seemingly implicit laws of units always there or did someone articulated them in the past?
Why can't you use the $\log$ or $\exp$ functions on numbers with units? (is it undefined? why?)
Why is it not ok to do math with different units, i.e. compare mass and distance, but it is ok to compare and do math with ratios of masses and ratios of distances?
Are there any laws that allow conversion of different units to one another or are there conservation laws for each unit?
 A: Many questions here.
Well, units have a formal definition in the sense that every physical quantity has two parts: A quantity and a unit. Take "distance". How would you describe distance using just a number? That's impossible. Stating just a number would immediately lead to the question "... of what?". 
Think about it like this: Everything you measure is stated as a ratio to a base quantity: How many meters? How many kilograms? How many seconds? These base quantities are the units. 
With that in mind, it's immediately clear why you can't add or subtract quantities with different units: Since a physical quantity tells you "how much of what", it just makes no sense to say "3 meters plus 2 seconds".
You can, however, multiply or divide quantities of different units, which gives you new units: Velocity is distance per time, so the unit of velocity must be the ratio of a unit of distance and a unit per time. It could be kilometers/hour, meters/second, miles/minute, whatever you can think of. 
Since you cannot add quantities of different units, it immediately follows that you cannot take the $\exp$. Let's take the $\exp$. You might know that 
$$\exp(x) = 1 + x + \frac{x^2}{2!} + \frac{x^3}{3!} + ...$$
Now if $x$ was, for example, "one meter", you would start adding things like 
$1 + 1m + \frac{1}{2} m^2 + ...$
but remember, you cannot add those! It doesn't make sense to add a number, a distance, an area, a volume etc etc.
Regarding the logarithm, here's something to consider: The log has a product rule like this $\log(a\cdot b) = \log(a) + \log(b)$.
Hence, you can in principle take the logarithm of a quantity with units, but only if you don't care about extra additive constants:
$\log(10 m/s) = \log(10) + \log(m/s)$, and the logarithm of "1 meter per 1 second" would be regarded as an additional constant that we don't care about.
But in general, when your function is not just a simple power, then you cannot apply it to a quantity with units.
About conversion of units: First, you can of course change the base quantity and measure distance either in meters, feet, miles or whatever, and the conversion is then achieved by a simple multiplication. 
You cannot "directly" convert between units that are meant to measure different things, i.e., you cannot convert meters to seconds. Sometimes the special context of your situation allows you to find "equivalent" quantities. In the US, recipes for baking usually tell you how many cups of flour, butter, sugar etc to use. So here the recipe measures the volume. In Europe (at least Germany and Austria), recipes are usually stated in terms of weight: How many grams of flour, butter, sugar, and so on. You can of course convert between those if you know the density of your product.
